Merge branch '32-finish-dashboard' into 'dev'
Resolve "Finish Dashboard" Closes #32 See merge request sa4-2020/the-sanmarinoes/frontend!38
1
smart-hut/public/img/dimmer.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg id="icons" enable-background="new 0 0 64 64" height="512" viewBox="0 0 64 64" width="512" xmlns="http://www.w3.org/2000/svg"><path d="m62 6.005v51.99c0 2.2-1.8 4-4 4h-52c-2.2 0-4-1.8-4-4v-51.99c0-2.199 1.8-4 4-4h52c2.2 0 4 1.801 4 4zm-5 50.99v-50h-50v50z" fill="#fff"/><path d="m32 17.025c5.24 0 9.99 2.12 13.43 5.56 3.431 3.44 5.561 8.181 5.561 13.42v.011h-2.991v-.011c0-8.829-7.17-16-16-16s-16 7.171-16 16v.011h-2.98v-.011c0-5.239 2.121-9.979 5.561-13.409 3.429-3.441 8.179-5.571 13.419-5.571z" fill="#94c1ff"/><path d="m32 17.025c-5.24 0-9.99 2.13-13.42 5.57-3.439 3.43-5.561 8.17-5.561 13.409v.011h2.981v-.011c0-8.829 7.17-16 16-16s16 7.171 16 16v.011h2.99v-.011c0-5.239-2.13-9.979-5.561-13.42-3.439-3.438-8.189-5.559-13.429-5.559zm13 18.98c0-7.17-5.82-13-13-13-7.17 0-13 5.83-13 13 0 7.171 5.83 13 13 13 7.18 0 13-5.829 13-13zm12-29.01v50h-50v-50z" fill="#d7e9ff"/><path d="m32 25.995c1.109 0 2 .9 2 2 0 1.101-.891 2-2 2-1.1 0-2-.899-2-2 0-1.099.9-2 2-2z" fill="#d7e9ff"/><path d="m32 25.995c-1.1 0-2 .9-2 2 0 1.101.9 2 2 2 1.109 0 2-.899 2-2 0-1.099-.891-2-2-2zm0-2.99c7.18 0 13 5.83 13 13 0 7.171-5.82 13-13 13-7.17 0-13-5.829-13-13 0-7.17 5.83-13 13-13z" fill="#fff"/><g fill="#116fff"><path d="m57.999 62.999h-51.998c-2.757 0-5-2.243-5-5v-51.998c0-2.757 2.243-5 5-5h51.998c2.757 0 5 2.243 5 5v51.998c0 2.757-2.243 5-5 5zm-51.998-59.998c-1.654 0-3 1.346-3 3v51.998c0 1.654 1.346 3 3 3h51.998c1.654 0 3-1.346 3-3v-51.998c0-1.654-1.346-3-3-3z"/><path d="m57 58h-50c-.553 0-1-.447-1-1v-50c0-.553.447-1 1-1h50c.553 0 1 .447 1 1v50c0 .553-.447 1-1 1zm-49-2h48v-48h-48z"/><path d="m32 50.004c-7.72 0-14-6.281-14-14.001 0-7.719 6.28-13.999 14-13.999s14 6.28 14 13.999c0 7.72-6.28 14.001-14 14.001zm0-26c-6.617 0-12 5.383-12 11.999 0 6.617 5.383 12.001 12 12.001s12-5.384 12-12.001c0-6.616-5.383-11.999-12-11.999z"/><path d="m32 30.995c-1.654 0-3-1.346-3-3s1.346-3 3-3 3 1.346 3 3-1.346 3-3 3zm0-4c-.552 0-1 .448-1 1s.448 1 1 1 1-.448 1-1-.448-1-1-1z"/><path d="m50.983 37.003c-.553 0-1-.447-1-1 0-9.916-8.067-17.982-17.983-17.982s-17.983 8.066-17.983 17.982c0 .553-.447 1-1 1s-1-.447-1-1c0-11.019 8.965-19.982 19.983-19.982s19.983 8.964 19.983 19.982c0 .553-.447 1-1 1z"/><path d="m48 37.003c-.553 0-1-.447-1-1 0-8.271-6.729-14.999-15-14.999s-15 6.729-15 14.999c0 .553-.447 1-1 1s-1-.447-1-1c0-9.373 7.626-16.999 17-16.999s17 7.626 17 16.999c0 .553-.447 1-1 1z"/><path d="m32 19.021c-.553 0-1-.447-1-1v-1.017c0-.553.447-1 1-1s1 .447 1 1v1.017c0 .553-.447 1-1 1z"/><path d="m19.278 24.291c-.256 0-.512-.098-.707-.293l-.719-.719c-.391-.391-.391-1.023 0-1.414s1.023-.391 1.414 0l.719.719c.391.391.391 1.023 0 1.414-.195.195-.451.293-.707.293z"/><path d="m15.998 37.013h-3.006c-.553 0-1-.447-1-1s.447-1 1-1h3.006c.553 0 1 .447 1 1s-.447 1-1 1z"/><path d="m51.007 37.014h-3.007c-.553 0-1-.447-1-1s.447-1 1-1h3.007c.553 0 1 .447 1 1s-.447 1-1 1z"/><path d="m44.721 24.293c-.256 0-.512-.098-.707-.293-.391-.391-.391-1.023 0-1.414l.72-.72c.391-.391 1.023-.391 1.414 0s.391 1.023 0 1.414l-.72.72c-.196.195-.451.293-.707.293z"/><path d="m11.044 12.021c-.553 0-1.005-.447-1.005-1s.442-1 .994-1h.011c.552 0 1 .447 1 1s-.448 1-1 1z"/><path d="m11.044 54.017c-.553 0-1.005-.447-1.005-1s.442-1 .994-1h.011c.552 0 1 .447 1 1s-.448 1-1 1z"/><path d="m53.046 12.021c-.553 0-1.005-.447-1.005-1s.442-1 .994-1h.011c.552 0 1 .447 1 1s-.448 1-1 1z"/><path d="m53.046 54.017c-.553 0-1.005-.447-1.005-1s.442-1 .994-1h.011c.552 0 1 .447 1 1s-.448 1-1 1z"/></g></svg>
|
After Width: | Height: | Size: 3.4 KiB |
1
smart-hut/public/img/humidity-sensor.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg id="Capa_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g id="XMLID_2040_"><circle id="XMLID_1170_" cx="210" cy="302" fill="#91def5" r="200"/><path id="XMLID_1252_" d="m310.911 116.754 84.079-106.754 84.079 106.754c33.55 42.598 29.941 103.557-8.401 141.899-41.796 41.796-109.561 41.796-151.357 0-38.342-38.342-41.951-99.301-8.4-141.899z" fill="#dff6fc"/><g id="XMLID_759_"><path id="XMLID_760_" d="m174.798 388.747c1.265.531 2.576.782 3.866.782 3.907 0 7.618-2.304 9.225-6.133l64.758-154.303c2.138-5.092-.259-10.953-5.351-13.09-5.095-2.138-10.954.258-13.091 5.351l-64.758 154.303c-2.137 5.092.259 10.953 5.351 13.09z"/><path id="XMLID_763_" d="m199.375 247.585c0-21.81-16.087-39.553-35.859-39.553s-35.858 17.743-35.858 39.553 16.086 39.553 35.858 39.553 35.859-17.744 35.859-39.553zm-35.859 19.552c-8.744 0-15.858-8.771-15.858-19.553s7.114-19.553 15.858-19.553c8.745 0 15.859 8.771 15.859 19.553s-7.114 19.553-15.859 19.553z"/><path id="XMLID_770_" d="m256.484 400.032c19.772 0 35.858-17.743 35.858-39.553s-16.086-39.553-35.858-39.553-35.859 17.743-35.859 39.553 16.087 39.553 35.859 39.553zm0-59.106c8.744 0 15.858 8.771 15.858 19.553s-7.114 19.553-15.858 19.553c-8.745 0-15.859-8.771-15.859-19.553s7.114-19.553 15.859-19.553z"/><path id="XMLID_773_" d="m486.926 110.567-84.079-106.754c-1.897-2.408-4.792-3.813-7.857-3.813s-5.96 1.405-7.855 3.813l-84.081 106.754c-.598.759-1.184 1.524-1.76 2.293-28.294-13.656-59.669-20.86-91.294-20.86-115.794 0-210 94.206-210 210s94.206 210 210 210c39.357 0 77.729-10.955 110.966-31.681 4.687-2.922 6.116-9.09 3.194-13.776-2.922-4.687-9.09-6.117-13.776-3.194-30.06 18.743-64.772 28.651-100.384 28.651-104.767 0-190-85.233-190-190s85.233-190 190-190c27.901 0 55.58 6.193 80.663 17.946-22.563 44.347-14.795 99.405 21.578 135.777 22.103 22.104 51.49 34.277 82.748 34.277 1.665 0 3.324-.042 4.978-.111.008.704.033 1.409.033 2.111 0 35.875-10.045 70.807-29.048 101.018-2.94 4.675-1.534 10.848 3.141 13.789 1.654 1.041 3.495 1.537 5.314 1.537 3.323 0 6.574-1.656 8.475-4.677 21.012-33.405 32.118-72.019 32.118-111.667 0-1.547-.039-3.102-.073-4.655 21.74-4.695 41.71-15.52 57.812-31.621 41.902-41.901 45.851-108.604 9.187-155.157zm-91.937 169.433c-25.916 0-50.281-10.092-68.606-28.418-34.741-34.74-38.016-90.043-7.616-128.64h-.001l76.225-96.779 76.223 96.779c30.399 38.597 27.125 93.9-7.616 128.641-18.327 18.325-42.692 28.417-68.609 28.417z"/><path id="XMLID_799_" d="m351.34 433.5c-2.64 0-5.22 1.07-7.07 2.93-1.859 1.86-2.93 4.44-2.93 7.07 0 2.64 1.07 5.21 2.93 7.08 1.86 1.86 4.431 2.92 7.07 2.92 2.63 0 5.2-1.06 7.07-2.92 1.859-1.87 2.93-4.44 2.93-7.08 0-2.63-1.07-5.21-2.93-7.07s-4.44-2.93-7.07-2.93z"/></g></g></svg>
|
After Width: | Height: | Size: 2.7 KiB |
1
smart-hut/public/img/intensity-light.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg height="512pt" viewBox="-1 0 512 512" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m255.128906 398.359375c-49.757812 0-90.234375-40.480469-90.234375-90.230469v-13.941406c0-8.429688 6.835938-15.265625 15.265625-15.265625h149.933594c8.429688 0 15.265625 6.835937 15.265625 15.265625v13.941406c0 49.75-40.480469 90.230469-90.230469 90.230469zm0 0" fill="#145180"/><path d="m330.089844 278.917969h-74.960938v119.441406c49.753906-.003906 90.230469-40.480469 90.230469-90.230469v-13.941406c0-8.433594-6.835937-15.269531-15.269531-15.269531zm0 0" fill="#082130"/><path d="m164.894531 294.1875v-57.515625c-28.894531-25.75-45.320312-62.191406-45.320312-101.121094 0-74.742187 60.808593-135.550781 135.554687-135.550781 74.742188 0 135.550782 60.808594 135.550782 135.550781 0 38.929688-16.425782 75.371094-45.320313 101.121094v57.515625zm0 0" fill="#fff04a"/><path d="m255.128906 0v294.1875h90.226563v-57.515625c28.898437-25.75 45.320312-62.191406 45.320312-101.121094 0-74.742187-60.804687-135.54687475-135.546875-135.550781zm0 0" fill="#ff961f"/><path d="m308.277344 126.613281c-5.960938-5.960937-15.628906-5.960937-21.589844 0l-31.558594 31.558594-31.558594-31.558594c-5.960937-5.964843-15.628906-5.964843-21.589843 0-5.964844 5.960938-5.964844 15.628907 0 21.589844l37.882812 37.882813v108.101562h30.53125v-108.101562l37.882813-37.882813c5.960937-5.960937 5.960937-15.628906 0-21.589844zm0 0" fill="#fff"/><path d="m286.6875 126.613281-31.558594 31.558594v136.015625h15.265625v-108.101562l37.882813-37.882813c5.960937-5.960937 5.960937-15.628906 0-21.589844-5.960938-5.960937-15.628906-5.960937-21.589844 0zm0 0" fill="#fff04a"/><path d="m494.992188 512h-479.726563c-8.429687 0-15.265625-6.835938-15.265625-15.265625v-51.90625c0-8.429687 6.835938-15.265625 15.265625-15.265625h479.726563c8.429687 0 15.265624 6.835938 15.265624 15.265625v51.90625c0 8.429687-6.832031 15.265625-15.265624 15.265625zm0 0" fill="#9ffeff"/><path d="m494.992188 429.5625h-239.863282v82.4375h239.863282c8.429687 0 15.265624-6.835938 15.265624-15.265625v-51.90625c0-8.429687-6.832031-15.265625-15.265624-15.265625zm0 0" fill="#78e3f6"/><path d="m494.992188 429.5625h-121.882813v82.4375h121.882813c8.429687 0 15.265624-6.835938 15.265624-15.265625v-51.90625c0-8.429687-6.832031-15.265625-15.265624-15.265625zm0 0" fill="#082130"/><path d="m494.992188 370.03125h-56.660157c-8.429687 0-15.265625-6.835938-15.265625-15.269531 0-8.429688 6.835938-15.265625 15.265625-15.265625h56.660157c8.429687 0 15.265624 6.835937 15.265624 15.265625 0 8.433593-6.832031 15.269531-15.265624 15.269531zm0 0" fill="#082130"/><path d="m71.925781 339.496094h-13.0625v-13.0625c0-8.429688-6.835937-15.265625-15.265625-15.265625-8.433594 0-15.269531 6.835937-15.269531 15.265625v13.0625h-13.0625c-8.429687 0-15.265625 6.835937-15.265625 15.265625 0 8.433593 6.835938 15.269531 15.265625 15.269531h13.0625v13.0625c0 8.429688 6.835937 15.265625 15.269531 15.265625 8.429688 0 15.265625-6.835937 15.265625-15.265625v-13.0625h13.0625c8.429688 0 15.265625-6.835938 15.265625-15.269531 0-8.429688-6.832031-15.265625-15.265625-15.265625zm0 0" fill="#145180"/></svg>
|
After Width: | Height: | Size: 3 KiB |
1
smart-hut/public/img/light-sensor.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg height="512pt" viewBox="0 0 512 512" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m256 394.414062c-77.425781 0-140.414062-62.988281-140.414062-140.410156 0-77.425781 62.988281-140.414062 140.414062-140.414062s140.414062 62.988281 140.414062 140.414062c0 77.421875-62.988281 140.410156-140.414062 140.410156zm0 0" fill="#ffe645"/><path d="m256 113.589844c-.003906 0-.007812 0-.007812 0v280.824218h.007812c77.425781 0 140.414062-62.988281 140.414062-140.410156 0-77.425781-62.988281-140.414062-140.414062-140.414062zm0 0" fill="#a19d8d"/><path d="m256 512c-8.285156 0-15-6.714844-15-15v-56c0-8.28125 6.714844-15 15-15s15 6.71875 15 15v56c0 8.285156-6.714844 15-15 15zm0 0" fill="#ffe645"/><path d="m497 271h-54.011719c-8.285156 0-15-6.714844-15-15 0-8.28125 6.714844-15 15-15h54.011719c8.285156 0 15 6.71875 15 15 0 8.285156-6.714844 15-15 15zm0 0" fill="#ffcf2c"/><path d="m69.011719 271h-54.011719c-8.285156 0-15-6.714844-15-15 0-8.28125 6.714844-15 15-15h54.011719c8.285156 0 15 6.71875 15 15 0 8.285156-6.714844 15-15 15zm0 0" fill="#ffe645"/><path d="m418.839844 176.996094c-5.183594 0-10.226563-2.691406-13.003906-7.503906-4.140626-7.171876-1.683594-16.347657 5.492187-20.488282l45.882813-26.492187c7.175781-4.144531 16.351562-1.683594 20.492187 5.492187 4.140625 7.171875 1.683594 16.347656-5.492187 20.488282l-45.882813 26.492187c-2.363281 1.363281-4.941406 2.011719-7.488281 2.011719zm0 0" fill="#ffcf2c"/><g fill="#ffe645"><path d="m48.140625 391.019531c-5.183594 0-10.226563-2.691406-13.003906-7.503906-4.144531-7.171875-1.683594-16.347656 5.488281-20.488281l46.785156-27.011719c7.175782-4.144531 16.347656-1.683594 20.488282 5.492187 4.144531 7.171876 1.6875 16.347657-5.488282 20.488282l-46.785156 27.011718c-2.359375 1.363282-4.941406 2.011719-7.484375 2.011719zm0 0"/><path d="m136.332031 478.246094c-2.542969 0-5.121093-.644532-7.484375-2.011719-7.175781-4.140625-9.632812-13.316406-5.492187-20.488281l27.007812-46.777344c4.140625-7.171875 13.316407-9.632812 20.488281-5.488281 7.175782 4.140625 9.632813 13.316406 5.492188 20.488281l-27.007812 46.777344c-2.777344 4.8125-7.820313 7.5-13.003907 7.5zm0 0"/><path d="m93.160156 176.996094c-2.546875 0-5.125-.648438-7.484375-2.011719l-46.78125-27.007813c-7.171875-4.140624-9.632812-13.316406-5.488281-20.492187 4.140625-7.171875 13.3125-9.632813 20.488281-5.488281l46.78125 27.007812c7.171875 4.140625 9.628907 13.316406 5.488281 20.488282-2.777343 4.8125-7.820312 7.503906-13.003906 7.503906zm0 0"/></g><path d="m464.699219 391.503906c-2.546875 0-5.125-.648437-7.488281-2.011718l-47.617188-27.492188c-7.171875-4.144531-9.628906-13.316406-5.488281-20.492188 4.140625-7.171874 13.316406-9.632812 20.488281-5.488281l47.617188 27.492188c7.175781 4.140625 9.632812 13.316406 5.492187 20.488281-2.777344 4.8125-7.820313 7.503906-13.003906 7.503906zm0 0" fill="#ffcf2c"/><path d="m375.667969 478.246094c-5.1875 0-10.226563-2.6875-13.003907-7.5l-27.003906-46.769532c-4.140625-7.175781-1.683594-16.347656 5.492188-20.488281 7.171875-4.144531 16.347656-1.6875 20.488281 5.488281l27.003906 46.769532c4.140625 7.175781 1.683594 16.347656-5.492187 20.488281-2.363282 1.367187-4.941406 2.011719-7.484375 2.011719zm0 0" fill="#ffcf2c"/><path d="m256 84c-8.285156 0-15-6.714844-15-15v-54c0-8.285156 6.714844-15 15-15s15 6.714844 15 15v54c0 8.285156-6.714844 15-15 15zm0 0" fill="#ffe645"/><path d="m348.632812 108.535156c-2.542968 0-5.125-.648437-7.484374-2.015625-7.175782-4.140625-9.632813-13.3125-5.492188-20.488281l27.007812-46.773438c4.140626-7.175781 13.3125-9.636718 20.488282-5.492187 7.175781 4.140625 9.632812 13.316406 5.492187 20.492187l-27.007812 46.773438c-2.777344 4.8125-7.820313 7.503906-13.003907 7.503906zm0 0" fill="#ffcf2c"/><path d="m163.363281 108.527344c-5.183593 0-10.226562-2.691406-13.003906-7.503906l-27.003906-46.765626c-4.140625-7.175781-1.683594-16.351562 5.492187-20.492187 7.171875-4.144531 16.347656-1.683594 20.488282 5.492187l27.003906 46.765626c4.140625 7.175781 1.683594 16.347656-5.492188 20.492187-2.359375 1.363281-4.941406 2.011719-7.484375 2.011719zm0 0" fill="#ffe645"/><path d="m256 426c-.003906 0-.007812 0-.007812 0v86h.007812c8.285156 0 15-6.714844 15-15v-56c0-8.28125-6.714844-15-15-15zm0 0" fill="#ffcf2c"/><path d="m256 0c-.003906 0-.007812 0-.007812 0v84h.007812c8.285156 0 15-6.714844 15-15v-54c0-8.285156-6.714844-15-15-15zm0 0" fill="#ffcf2c"/></svg>
|
After Width: | Height: | Size: 4.3 KiB |
1
smart-hut/public/img/sensorOff.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m437.066 74.981c-5.857-5.858-15.355-5.858-21.213 0s-5.858 15.355 0 21.213c42.656 42.655 66.147 99.409 66.147 159.806s-23.491 117.151-66.147 159.806c-5.858 5.857-5.858 15.355 0 21.213 5.868 5.868 15.365 5.848 21.213 0 48.322-48.321 74.934-112.608 74.934-181.019s-26.612-132.698-74.934-181.019z"/><path d="m391.646 120.4c-5.858-5.857-15.356-5.857-21.213 0-5.857 5.858-5.857 15.355 0 21.213 30.533 30.531 47.349 71.155 47.349 114.387s-16.815 83.855-47.349 114.387c-5.858 5.858-5.858 15.355 0 21.213 5.856 5.856 15.353 5.859 21.213 0 36.2-36.198 56.136-84.355 56.136-135.601s-19.937-99.402-56.136-135.599z"/><path d="m346.193 165.852c-5.858-5.857-15.356-5.857-21.213 0-5.858 5.858-5.857 15.356 0 21.213 18.4 18.398 28.533 42.88 28.533 68.934s-10.133 50.536-28.533 68.934c-5.858 5.857-5.858 15.355 0 21.213 5.857 5.857 15.354 5.859 21.213 0 24.066-24.065 37.32-56.08 37.32-90.148s-13.254-66.081-37.32-90.146z"/><path d="m30 256c0-60.397 23.491-117.151 66.147-159.806 5.858-5.857 5.858-15.355 0-21.213-5.857-5.857-15.354-5.858-21.213 0-48.322 48.321-74.934 112.608-74.934 181.019s26.612 132.698 74.934 181.019c5.856 5.857 15.355 5.859 21.213 0 5.858-5.858 5.858-15.355 0-21.213-42.656-42.655-66.147-99.409-66.147-159.806z"/><path d="m94.219 256c0-43.232 16.815-83.855 47.349-114.387 5.858-5.858 5.858-15.355 0-21.213-5.857-5.858-15.355-5.857-21.213 0-36.2 36.197-56.136 84.355-56.136 135.6s19.936 99.403 56.136 135.601c5.866 5.865 15.363 5.85 21.213 0 5.857-5.858 5.857-15.355 0-21.213-30.534-30.532-47.349-71.156-47.349-114.388z"/><path d="m187.021 165.853c-5.857-5.858-15.355-5.858-21.213 0-24.066 24.065-37.32 56.08-37.32 90.148s13.254 66.083 37.32 90.148c5.866 5.865 15.363 5.85 21.213 0 5.858-5.858 5.857-15.356 0-21.213-18.4-18.398-28.533-42.88-28.533-68.934s10.133-50.536 28.533-68.934c5.857-5.859 5.857-15.357 0-21.215z"/><path d="m256 192.8c-34.849 0-63.2 28.352-63.2 63.2s28.352 63.2 63.2 63.2 63.2-28.352 63.2-63.2-28.351-63.2-63.2-63.2z"/></g></svg>
|
After Width: | Height: | Size: 2.1 KiB |
1
smart-hut/public/img/sensorOn.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m415.853 437.019c-5.858-5.858-5.858-15.355 0-21.213 42.656-42.655 66.147-99.409 66.147-159.806s-23.491-117.151-66.147-159.806c-5.858-5.857-5.858-15.355 0-21.213 5.857-5.858 15.355-5.858 21.213 0 48.322 48.321 74.934 112.608 74.934 181.019s-26.612 132.698-74.934 181.019c-5.848 5.848-15.345 5.868-21.213 0z" fill="#7affe4"/><path d="m370.432 391.6c-5.857-5.858-5.857-15.355 0-21.213 30.533-30.531 47.349-71.155 47.349-114.387s-16.815-83.855-47.349-114.387c-5.858-5.858-5.858-15.355 0-21.213 5.857-5.857 15.355-5.858 21.213 0 36.2 36.198 56.136 84.355 56.136 135.601s-19.936 99.403-56.136 135.601c-5.86 5.858-15.356 5.855-21.213-.002z" fill="#00ddc1"/><path d="m324.979 346.148c-5.858-5.858-5.857-15.356 0-21.213 18.4-18.398 28.533-42.88 28.533-68.934s-10.133-50.536-28.533-68.934c-5.858-5.857-5.858-15.355 0-21.213 5.857-5.857 15.355-5.858 21.213 0 24.066 24.065 37.32 56.08 37.32 90.148s-13.254 66.083-37.32 90.148c-5.858 5.857-15.356 5.854-21.213-.002z" fill="#7affe4"/><path d="m415.853 437.019c5.868 5.868 15.365 5.848 21.213 0 48.322-48.321 74.934-112.608 74.934-181.019h-30c0 60.397-23.491 117.151-66.147 159.806-5.858 5.858-5.858 15.355 0 21.213z" fill="#00ddc1"/><path d="m370.432 391.6c5.856 5.856 15.353 5.859 21.213 0 36.2-36.198 56.136-84.355 56.136-135.601h-30c0 43.232-16.815 83.855-47.349 114.387-5.857 5.859-5.857 15.356 0 21.214z" fill="#00b4bc"/><path d="m324.979 346.148c5.857 5.857 15.354 5.859 21.213 0 24.066-24.065 37.32-56.08 37.32-90.148h-30c0 26.054-10.133 50.536-28.533 68.934-5.857 5.858-5.857 15.355 0 21.214z" fill="#00ddc1"/><path d="m74.934 437.019c-48.322-48.321-74.934-112.608-74.934-181.019s26.612-132.698 74.934-181.019c5.858-5.858 15.355-5.857 21.213 0 5.858 5.858 5.858 15.355 0 21.213-42.656 42.655-66.147 99.409-66.147 159.806s23.491 117.151 66.147 159.806c5.858 5.857 5.858 15.355 0 21.213-5.858 5.859-15.357 5.857-21.213 0z" fill="#7affe4"/><path d="m120.354 391.601c-36.199-36.198-56.135-84.355-56.135-135.601s19.936-99.403 56.136-135.601c5.858-5.857 15.356-5.857 21.213 0 5.857 5.858 5.857 15.355 0 21.213-30.534 30.533-47.349 71.156-47.349 114.388s16.815 83.855 47.349 114.387c5.858 5.858 5.858 15.355 0 21.213-5.85 5.85-15.347 5.866-21.214.001z" fill="#00ddc1"/><path d="m165.807 346.148c-24.066-24.065-37.32-56.08-37.32-90.148s13.254-66.083 37.32-90.148c5.858-5.858 15.356-5.857 21.213 0 5.858 5.858 5.857 15.356 0 21.213-18.4 18.398-28.533 42.88-28.533 68.934s10.133 50.536 28.533 68.934c5.858 5.857 5.858 15.355 0 21.213-5.85 5.852-15.347 5.867-21.213.002z" fill="#7affe4"/><path d="m96.147 437.019c5.858-5.858 5.858-15.355 0-21.213-42.656-42.655-66.147-99.409-66.147-159.806h-30c0 68.411 26.612 132.698 74.934 181.019 5.856 5.857 15.355 5.859 21.213 0z" fill="#00ddc1"/><path d="m141.568 391.6c5.857-5.858 5.857-15.355 0-21.213-30.534-30.531-47.349-71.155-47.349-114.387h-30c0 51.246 19.936 99.403 56.136 135.601 5.866 5.865 15.363 5.849 21.213-.001z" fill="#00b4bc"/><path d="m187.021 346.148c5.858-5.858 5.857-15.356 0-21.213-18.4-18.398-28.533-42.88-28.533-68.934h-30c0 34.068 13.254 66.083 37.32 90.148 5.865 5.864 15.362 5.849 21.213-.001z" fill="#00ddc1"/><circle cx="256" cy="256" fill="#00ddc1" r="63.2"/><path d="m256 319.2c34.849 0 63.2-28.352 63.2-63.2h-126.4c0 34.849 28.351 63.2 63.2 63.2z" fill="#00b4bc"/></g></svg>
|
After Width: | Height: | Size: 3.3 KiB |
48
smart-hut/public/img/switchOff.svg
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path d="M336.709,74.843c-10.322-3.944-21.88,1.219-25.825,11.537c-3.945,10.316,1.22,21.879,11.536,25.824
|
||||||
|
C393.115,139.239,442,207.384,442,286c0,102.561-83.439,186-186,186S70,388.561,70,286c0-78.659,48.908-146.766,119.573-173.793
|
||||||
|
c10.317-3.946,15.481-15.509,11.536-25.825c-3.947-10.317-15.512-15.48-25.825-11.536C89.185,107.777,30,190.692,30,286
|
||||||
|
c0,124.922,101.09,226,226,226c124.922,0,226-101.09,226-226C482,190.65,422.778,107.759,336.709,74.843z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path d="M256,0c-11.046,0-20,8.954-20,20v195.851c0,11.046,8.954,20,20,20s20-8.955,20-20V20C276,8.954,267.046,0,256,0z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
48
smart-hut/public/img/switchOn.svg
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||||
|
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="30" y1="258" x2="482" y2="258" gradientTransform="matrix(1 0 0 -1 0 514)">
|
||||||
|
<stop offset="0" style="stop-color:#80D8FF"/>
|
||||||
|
<stop offset="0.16" style="stop-color:#88D1FF"/>
|
||||||
|
<stop offset="0.413" style="stop-color:#9FBEFE"/>
|
||||||
|
<stop offset="0.725" style="stop-color:#C4A0FD"/>
|
||||||
|
<stop offset="1" style="stop-color:#EA80FC"/>
|
||||||
|
</linearGradient>
|
||||||
|
<path style="fill:url(#SVGID_1_);" d="M256,512C131.09,512,30,410.922,30,286c0-95.308,59.185-178.223,145.284-211.154
|
||||||
|
c10.313-3.944,21.878,1.219,25.825,11.536c3.945,10.316-1.219,21.879-11.536,25.825C118.908,139.234,70,207.341,70,286
|
||||||
|
c0,102.561,83.439,186,186,186s186-83.439,186-186c0-78.616-48.885-146.761-119.58-173.796
|
||||||
|
c-10.316-3.945-15.481-15.508-11.536-25.824c3.945-10.318,15.503-15.481,25.825-11.537C422.778,107.759,482,190.65,482,286
|
||||||
|
C482,410.91,380.922,512,256,512z M276,215.851V20c0-11.046-8.954-20-20-20s-20,8.954-20,20v195.851c0,11.046,8.954,20,20,20
|
||||||
|
C267.046,235.851,276,226.896,276,215.851z"/>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
14
smart-hut/public/img/temperature-sensor.svg
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="590pt" version="1.1" viewBox="-193 0 590 590.60879" width="590pt">
|
||||||
|
<g id="surface1">
|
||||||
|
<path d="M 163.433594 407.625 L 163.433594 61.121094 C 163.433594 27.363281 136.070312 0 102.308594 0 C 68.550781 0 41.1875 27.363281 41.1875 61.121094 L 41.1875 407.625 C -3.820312 441.386719 -12.945312 505.238281 20.8125 550.246094 C 54.574219 595.253906 118.425781 604.378906 163.433594 570.621094 C 208.441406 536.859375 217.566406 473.007812 183.808594 428 C 178.019531 420.277344 171.15625 413.421875 163.433594 407.625 Z M 163.433594 407.625 " style=" stroke:none;fill-rule:nonzero;fill:rgb(41.176471%,80%,84.313725%);fill-opacity:1;" />
|
||||||
|
<path d="M 163.433594 407.625 L 163.433594 244.488281 L 41.1875 366.734375 L 41.1875 407.625 C -3.820312 441.386719 -12.945312 505.238281 20.8125 550.246094 C 54.574219 595.253906 118.425781 604.378906 163.433594 570.621094 C 208.441406 536.859375 217.566406 473.007812 183.808594 428 C 178.019531 420.277344 171.15625 413.421875 163.433594 407.625 Z M 163.433594 407.625 " style=" stroke:none;fill-rule:nonzero;fill:rgb(38.039216%,74.117647%,78.039216%);fill-opacity:1;" />
|
||||||
|
<path d="M 143.058594 488.980469 C 143.058594 511.484375 124.816406 529.726562 102.308594 529.726562 C 79.804688 529.726562 61.5625 511.484375 61.5625 488.980469 C 61.5625 466.476562 79.804688 448.230469 102.308594 448.230469 C 124.816406 448.230469 143.058594 466.476562 143.058594 488.980469 Z M 143.058594 488.980469 " style=" stroke:none;fill-rule:nonzero;fill:rgb(92.941176%,19.215686%,14.117647%);fill-opacity:1;" />
|
||||||
|
<path d="M 92.125 81.496094 L 112.496094 81.496094 L 112.496094 478.792969 L 92.125 478.792969 Z M 92.125 81.496094 " style=" stroke:none;fill-rule:nonzero;fill:rgb(92.941176%,19.215686%,14.117647%);fill-opacity:1;" />
|
||||||
|
<path d="M 41.1875 356.546875 L 71.75 356.546875 L 71.75 376.921875 L 41.1875 376.921875 Z M 41.1875 356.546875 " style=" stroke:none;fill-rule:nonzero;fill:rgb(31.764706%,61.568627%,65.098039%);fill-opacity:1;" />
|
||||||
|
<path d="M 41.1875 305.613281 L 71.75 305.613281 L 71.75 325.988281 L 41.1875 325.988281 Z M 41.1875 305.613281 " style=" stroke:none;fill-rule:nonzero;fill:rgb(31.764706%,61.568627%,65.098039%);fill-opacity:1;" />
|
||||||
|
<path d="M 41.1875 254.675781 L 71.75 254.675781 L 71.75 275.050781 L 41.1875 275.050781 Z M 41.1875 254.675781 " style=" stroke:none;fill-rule:nonzero;fill:rgb(31.764706%,61.568627%,65.098039%);fill-opacity:1;" />
|
||||||
|
<path d="M 41.1875 203.742188 L 71.75 203.742188 L 71.75 224.117188 L 41.1875 224.117188 Z M 41.1875 203.742188 " style=" stroke:none;fill-rule:nonzero;fill:rgb(31.764706%,61.568627%,65.098039%);fill-opacity:1;" />
|
||||||
|
<path d="M 41.1875 152.804688 L 71.75 152.804688 L 71.75 173.179688 L 41.1875 173.179688 Z M 41.1875 152.804688 " style=" stroke:none;fill-rule:nonzero;fill:rgb(31.764706%,61.568627%,65.098039%);fill-opacity:1;" />
|
||||||
|
<path d="M 41.1875 101.871094 L 71.75 101.871094 L 71.75 122.246094 L 41.1875 122.246094 Z M 41.1875 101.871094 " style=" stroke:none;fill-rule:nonzero;fill:rgb(31.764706%,61.568627%,65.098039%);fill-opacity:1;" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3 KiB |
|
@ -50,10 +50,10 @@ export default class DevicePanel extends Component {
|
||||||
return (
|
return (
|
||||||
<div style={panelStyle}>
|
<div style={panelStyle}>
|
||||||
<button style={editButtonStyle} onClick={this.editModeController}>Edit</button>
|
<button style={editButtonStyle} onClick={this.editModeController}>Edit</button>
|
||||||
<Grid doubling columns={this.props.devices.length > 0 ? this.props.devices.length : 1} divided="vertically">
|
<Grid doubling columns={this.state.devices.length > 0 ? this.state.devices.length : 1} divided="vertically">
|
||||||
{
|
{
|
||||||
this.props.devices ?
|
this.state.devices ?
|
||||||
this.props.devices.map((e, i) => {
|
this.state.devices.map((e, i) => {
|
||||||
return (
|
return (
|
||||||
<Grid.Column key={i}>
|
<Grid.Column key={i}>
|
||||||
<DeviceType type={e.kind} onChangeData={this.changeDeviceData} device={e} edit={this.state.editMode}/>
|
<DeviceType type={e.kind} onChangeData={this.changeDeviceData} device={e} edit={this.state.editMode}/>
|
||||||
|
@ -64,7 +64,7 @@ export default class DevicePanel extends Component {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
<Grid.Column>
|
<Grid.Column>
|
||||||
<NewDevice/>
|
<NewDevice devices={this.state.devices}/>
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
import React, {Component} from 'react';
|
|
||||||
import {Image} from "semantic-ui-react";
|
|
||||||
import {iconStyle, nameStyle, StyledDiv} from "./styleComponents";
|
|
||||||
import Settings from './DeviceSettings';
|
|
||||||
|
|
||||||
|
|
||||||
export default class Device extends Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
turnOnOff: "off",
|
|
||||||
icon: this.props.device.img
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClickDevice = () => {
|
|
||||||
if (!this.props.edit) {
|
|
||||||
if (this.props.device.type === "light") {
|
|
||||||
if (this.state.turnOnOff === "on") {
|
|
||||||
this.setState({
|
|
||||||
turnOnOff: "off",
|
|
||||||
icon: this.props.device.img
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
turnOnOff: "on",
|
|
||||||
icon: this.props.device.imgClick
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<StyledDiv onClick={this.props.edit ? () => {
|
|
||||||
} : this.onClickDevice} style={{textAlign: "center"}}>
|
|
||||||
<Settings
|
|
||||||
deviceId={this.props.device.id}
|
|
||||||
edit={this.props.edit}
|
|
||||||
onChangeData={(id, newSettings) => this.props.onChangeData(id, newSettings)}/>
|
|
||||||
<Image src={this.state.icon} style={iconStyle}/>
|
|
||||||
<h5 style={nameStyle}>{this.props.device.name}</h5>
|
|
||||||
</StyledDiv>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,12 @@
|
||||||
import React, {Component} from "react";
|
import React, {Component} from "react";
|
||||||
import {Button, Form} from "semantic-ui-react";
|
import {editModeIconStyle, editModeStyle} from "./styleComponents";
|
||||||
import {editModeIconStyle, editModeStyle, formStyle} from "./styleComponents";
|
|
||||||
|
|
||||||
class SettingsForm extends Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = {}
|
|
||||||
};
|
|
||||||
|
|
||||||
onChangeHandler = (event) => {
|
|
||||||
let nam = event.target.name;
|
|
||||||
let val = event.target.value;
|
|
||||||
this.setState({[nam]: val});
|
|
||||||
};
|
|
||||||
|
|
||||||
saveChanges = () => {
|
|
||||||
let newName = this.state["new-name"];
|
|
||||||
this.props.onChangeData(this.props.id, {"name": newName});
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<Form style={formStyle}>
|
|
||||||
<Form.Field>
|
|
||||||
<label style={{color: "white"}}>New Device Name</label>
|
|
||||||
<input name="new-name" placeholder='New name' onChange={this.onChangeHandler}/>
|
|
||||||
</Form.Field>
|
|
||||||
<Button type='submit' onClick={this.saveChanges}>Save</Button>
|
|
||||||
</Form>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default class Settings extends Component {
|
export default class Settings extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
displayForm: false,
|
displayForm: true,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,26 +16,18 @@ export default class Settings extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const view = (
|
const view = (
|
||||||
<div>
|
<div onClick={() => this.props.edit.openModal(this.props.deviceId)}>
|
||||||
{this.state.displayForm ? (
|
|
||||||
<SettingsForm id={this.props.deviceId} onChangeData={this.props.onChangeData}/>) : ("")}
|
|
||||||
<div onClick={this.displayForm}>
|
|
||||||
<span style={editModeStyle}>
|
<span style={editModeStyle}>
|
||||||
{!this.state.displayForm ? (
|
|
||||||
<img
|
<img
|
||||||
src="/img/settings.svg"
|
src="/img/settings.svg"
|
||||||
alt=""
|
alt=""
|
||||||
style={editModeIconStyle}/>)
|
style={editModeIconStyle}/>
|
||||||
:
|
|
||||||
<p style={{color: "white"}}>×</p>
|
|
||||||
}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{this.props.edit ? view : ("")}
|
{this.props.edit.mode ? view : ("")}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@ import Light from "./Light";
|
||||||
import SmartPlug from "./SmartPlug";
|
import SmartPlug from "./SmartPlug";
|
||||||
import Sensor from "./Sensor";
|
import Sensor from "./Sensor";
|
||||||
import DefaultDimmer from "./Dimmer";
|
import DefaultDimmer from "./Dimmer";
|
||||||
import Switcher from "./Switcher";
|
import Switcher from "./Switch";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
58
smart-hut/src/components/dashboard/devices/DigitalSensor.js
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/**
|
||||||
|
* Users can add sensors in their rooms.
|
||||||
|
* Sensors typically measure physical quantities in a room.
|
||||||
|
* You must support temperature sensors, humidity sensors, light sensors (which measure luminosity1).
|
||||||
|
* Sensors have an internal state that cannot be changed by the user.
|
||||||
|
* For this story, make the sensors return a constant value with some small random error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React, {Component} from "react";
|
||||||
|
import {CircularInput, CircularProgress, CircularTrack} from "react-circular-input";
|
||||||
|
import {errorStyle, sensorText, style, valueStyle} from "./SensorStyle";
|
||||||
|
import {StyledDiv} from "./styleComponents";
|
||||||
|
import Settings from "./DeviceSettings";
|
||||||
|
import {Image} from "semantic-ui-react";
|
||||||
|
import {imageStyle, nameStyle} from "./DigitalSensorStyle";
|
||||||
|
|
||||||
|
export default class DigitalSensor extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
value: false, // This value is a boolean, was this type of sensor returns presence/absence
|
||||||
|
};
|
||||||
|
|
||||||
|
this.iconOn = "/img/sensorOn.svg";
|
||||||
|
this.iconOff = "/img/sensorOff.svg"
|
||||||
|
}
|
||||||
|
|
||||||
|
setName = () => {
|
||||||
|
if(this.props.device.name.length > 15){
|
||||||
|
return this.props.device.name.slice(0,12) + "..."
|
||||||
|
}
|
||||||
|
return this.props.device.name;
|
||||||
|
};
|
||||||
|
|
||||||
|
getIcon = () => {
|
||||||
|
if(this.state.value){
|
||||||
|
return this.iconOn;
|
||||||
|
}
|
||||||
|
return this.iconOff;
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<StyledDiv>
|
||||||
|
<Settings
|
||||||
|
deviceId={this.props.device.id}
|
||||||
|
edit={this.props.edit}
|
||||||
|
onChangeData={(id, newSettings) => this.props.onChangeData(id, newSettings)}/>
|
||||||
|
<Image src={this.getIcon()} style={imageStyle}/>
|
||||||
|
<h5 style={nameStyle}>{this.props.device.name}</h5>
|
||||||
|
</StyledDiv>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
export const imageStyle = {
|
||||||
|
width: "3.5rem",
|
||||||
|
height: "auto",
|
||||||
|
position: "absolute",
|
||||||
|
top: "20%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translateX(-50%)",
|
||||||
|
filter: "drop-shadow( 1px 1px 0.5px rgba(0, 0, 0, .25))"
|
||||||
|
};
|
||||||
|
|
||||||
|
export const nameStyle = {
|
||||||
|
color : "black",
|
||||||
|
position: "absolute",
|
||||||
|
top: "40%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translateX(-50%)"
|
||||||
|
};
|
|
@ -7,11 +7,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {Component} from "react";
|
import React, {Component} from "react";
|
||||||
import {iconStyle, StyledDiv, nameStyle} from "./styleComponents";
|
import {iconStyle, StyledDiv} from "./styleComponents";
|
||||||
import Settings from "./DeviceSettings";
|
import Settings from "./DeviceSettings";
|
||||||
import {Image} from "semantic-ui-react";
|
import {Image} from "semantic-ui-react";
|
||||||
import {CircularInput, CircularProgress, CircularThumb, CircularTrack} from "react-circular-input";
|
import {CircularInput, CircularProgress, CircularThumb, CircularTrack} from "react-circular-input";
|
||||||
import {valueStyle, intensityLightStyle, style} from "./LightStyle";
|
import {valueStyle, intensityLightStyle, style, nameStyle} from "./LightStyle";
|
||||||
|
|
||||||
export default class Light extends Component {
|
export default class Light extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -25,7 +25,6 @@ export default class Light extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickDevice = () => {
|
onClickDevice = () => {
|
||||||
|
|
||||||
this.setState((prevState) => ({turnedOn: !prevState.turnedOn}));
|
this.setState((prevState) => ({turnedOn: !prevState.turnedOn}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,21 +72,21 @@ export default class Light extends Component {
|
||||||
);
|
);
|
||||||
|
|
||||||
const normalLightView = (
|
const normalLightView = (
|
||||||
<StyledDiv onClick={this.props.edit ? () => {
|
<div onClick={this.props.edit.mode ? () => {
|
||||||
} : this.onClickDevice} style={{textAlign: "center"}}>
|
} : this.onClickDevice}>
|
||||||
|
<Image src={this.getIcon()} style={iconStyle}/>
|
||||||
|
<h5 style={nameStyle}>{this.props.device.name}</h5>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledDiv>
|
||||||
<Settings
|
<Settings
|
||||||
deviceId={this.props.device.id}
|
deviceId={this.props.device.id}
|
||||||
edit={this.props.edit}
|
edit={this.props.edit}
|
||||||
onChangeData={(id, newSettings) => this.props.onChangeData(id, newSettings)}/>
|
onChangeData={(id, newSettings) => this.props.onChangeData(id, newSettings)}/>
|
||||||
<Image src={this.getIcon()} style={iconStyle}/>
|
|
||||||
<h5 style={nameStyle}>{this.props.device.name}</h5>
|
|
||||||
</StyledDiv>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<React.Fragment>
|
|
||||||
{this.state.hasIntensity ? (intensityLightView) : (normalLightView)}
|
{this.state.hasIntensity ? (intensityLightView) : (normalLightView)}
|
||||||
</React.Fragment>
|
</StyledDiv>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,16 @@ export const valueStyle = {
|
||||||
|
|
||||||
export const intensityLightStyle = {
|
export const intensityLightStyle = {
|
||||||
fill: "#3e99ff",
|
fill: "#3e99ff",
|
||||||
fontSize: "1.5rem",
|
fontSize: "1.2rem",
|
||||||
fontFamily: "Lato",
|
fontFamily: "Lato",
|
||||||
textShadow: "1px 1px 0.5px rgba(0, 0, 0, .2)",
|
textShadow: "1px 1px 0.5px rgba(0, 0, 0, .2)",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const nameStyle = {
|
||||||
|
fontSize : "1rem",
|
||||||
|
position: "absolute",
|
||||||
|
top: "50%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translateX(-50%)",
|
||||||
|
color : "black"
|
||||||
|
};
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import {Button, Dropdown, Form, Image} from "semantic-ui-react";
|
import {Button, Dropdown, Form, Icon, Image, Input, Modal} from "semantic-ui-react";
|
||||||
import {addDeviceFormStyle} from "./styleComponents";
|
|
||||||
import {deviceList} from "./TypesOfDevices";
|
|
||||||
|
|
||||||
const StyledDiv = styled.div`
|
const StyledDiv = styled.div`
|
||||||
background-color : #ff4050;
|
background-color : #ff4050;
|
||||||
|
@ -19,90 +17,208 @@ const StyledDiv = styled.div`
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
class NewDeviceForm extends Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
formSelector = (option) => {
|
|
||||||
switch (option) {
|
|
||||||
case "Light":
|
|
||||||
return <LightForm/>;
|
|
||||||
case "Sensor":
|
|
||||||
return "This is a sensor form";
|
|
||||||
default:
|
|
||||||
return "This is a default text"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let options = [];
|
|
||||||
deviceList.forEach((e, i) => {
|
|
||||||
options.push({key: i, text: e, value: e})
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Form style={addDeviceFormStyle}>
|
|
||||||
<Form.Field>
|
|
||||||
<label style={{color: "white"}}>Select the type of device</label>
|
|
||||||
<Dropdown clearable options={options} selection/>
|
|
||||||
</Form.Field>
|
|
||||||
|
|
||||||
<Button type='submit' onClick={this.saveChanges}>Save</Button>
|
|
||||||
</Form>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class LightForm extends Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let options = [
|
|
||||||
{
|
|
||||||
key: 1,
|
|
||||||
value: "common",
|
|
||||||
text: "Normal Light"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 1,
|
|
||||||
value: "intensity",
|
|
||||||
text: "Supports intensity level"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
return (
|
|
||||||
<Form.Field>
|
|
||||||
<label style={{color: "white"}}>Type of light</label>
|
|
||||||
<Dropdown clearable options={options} selection/>
|
|
||||||
</Form.Field>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class NewDevice extends Component {
|
export default class NewDevice extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
openForm: false
|
step: 1,
|
||||||
}
|
openModal : false
|
||||||
|
};
|
||||||
|
this.baseState = this.state
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickDevice = (event) => {
|
handleOpen = () => {this.setState({openModal : true})};
|
||||||
this.setState((prevState) => ({openForm: !prevState.openForm}));
|
handleClose = () => {this.setState({openModal : false})};
|
||||||
|
|
||||||
|
|
||||||
|
resetState = () => {
|
||||||
|
this.setState(this.baseState);
|
||||||
|
this.handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nextStep = () => {
|
||||||
|
this.setState((prevState) => ({step: prevState.step + 1}));
|
||||||
|
};
|
||||||
|
previousStep = () => {
|
||||||
|
this.setState((prevState) => ({step: prevState.step - 1}));
|
||||||
|
};
|
||||||
|
|
||||||
|
setTypeOfDevice = (e, d) => {
|
||||||
|
this.setState({typeOfDevice: d.value});
|
||||||
|
};
|
||||||
|
|
||||||
|
setDeviceName = (e, d) => {
|
||||||
|
this.setState({deviceName: d.value});
|
||||||
|
};
|
||||||
|
|
||||||
|
setTypeOfSensor = (e, d) => {
|
||||||
|
this.setState({typeOfSensor: d.value});
|
||||||
|
};
|
||||||
|
|
||||||
|
setLightsDimmerSwitch = (e, d) => {
|
||||||
|
this.setState({lightsAttached : d.value});
|
||||||
|
};
|
||||||
|
|
||||||
|
createDevice = () => {
|
||||||
|
// Connect to the backend and create device here.
|
||||||
|
this.resetState();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const deviceOptions = [
|
||||||
|
{
|
||||||
|
key: 'light',
|
||||||
|
text: 'Normal Light',
|
||||||
|
value: 'light',
|
||||||
|
image: {avatar: true, src: '/img/lightOn.svg'},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'intensity-light',
|
||||||
|
text: 'Intensity Light',
|
||||||
|
value: 'intensity-light',
|
||||||
|
image: {avatar: true, src: '/img/intensity-light.svg'},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'smart-plug',
|
||||||
|
text: 'Smart Plug',
|
||||||
|
value: 'smart-plug',
|
||||||
|
image: {avatar: true, src: '/img/smart-plug.svg'},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'sensor',
|
||||||
|
text: 'Sensor',
|
||||||
|
value: 'sensor',
|
||||||
|
image: {avatar: true, src: '/img/sensorOn.svg'},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'switch',
|
||||||
|
text: 'Switch',
|
||||||
|
value: 'switch',
|
||||||
|
image: {avatar: true, src: '/img/switchOn.svg'},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'dimmer',
|
||||||
|
text: 'Dimmer',
|
||||||
|
value: 'dimmer',
|
||||||
|
image: {avatar: true, src: '/img/dimmer.svg'},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const sensorOptions = [
|
||||||
|
{
|
||||||
|
key: "temperature",
|
||||||
|
text: "Temperature Sensor",
|
||||||
|
value: "temperature",
|
||||||
|
image: {avatar: true, src: '/img/temperature-sensor.svg'},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "humidity",
|
||||||
|
text: "Humidity Sensor",
|
||||||
|
value: "humidity",
|
||||||
|
image: {avatar: true, src: '/img/humidity-sensor.svg'},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "light",
|
||||||
|
text: "Light Sensor",
|
||||||
|
value: "light",
|
||||||
|
image: {avatar: true, src: '/img/light-sensor.svg'},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "motion",
|
||||||
|
text: "Motion Sensor",
|
||||||
|
value: "motion",
|
||||||
|
image: {avatar: true, src: '/img/sensorOn.svg'},
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const availableLights = [];
|
||||||
|
this.props.devices.forEach(d => {
|
||||||
|
availableLights.push(
|
||||||
|
{
|
||||||
|
key: d.id,
|
||||||
|
text: d.name,
|
||||||
|
value: d.id,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
});
|
||||||
|
const step1 = (
|
||||||
|
<Dropdown
|
||||||
|
name="typeOfDevice"
|
||||||
|
placeholder='Select a Type of Device'
|
||||||
|
fluid
|
||||||
|
selection
|
||||||
|
onChange={this.setTypeOfDevice}
|
||||||
|
options={deviceOptions}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
const step2 = (typeOfDevice) => {
|
||||||
|
const deviceName = (<div>
|
||||||
|
<Form.Field>
|
||||||
|
<label>Device Name: </label>
|
||||||
|
<Input fluid size={"large"} onChange={this.setDeviceName} focus placeholder='Device Name'/>
|
||||||
|
</Form.Field>
|
||||||
|
</div>);
|
||||||
|
const sensorForm = (<Form.Field style={{marginTop : "1rem"}}>
|
||||||
|
<label>Type of Sensor: </label>
|
||||||
|
<Dropdown
|
||||||
|
name="typeOfDevice"
|
||||||
|
placeholder='Select a Type of Sensor'
|
||||||
|
fluid
|
||||||
|
selection
|
||||||
|
onChange={this.setTypeOfSensor}
|
||||||
|
options={sensorOptions}
|
||||||
|
/>
|
||||||
|
</Form.Field>);
|
||||||
|
const switchDimmerOptions = (<Form.Field style={{marginTop : "1rem"}}>
|
||||||
|
<label>Select the Lights You Want to Attach: </label>
|
||||||
|
<Dropdown
|
||||||
|
name="typeOfDevice"
|
||||||
|
placeholder='Select Lights'
|
||||||
|
fluid
|
||||||
|
multiple
|
||||||
|
onChange={this.setLightsDimmerSwitch}
|
||||||
|
options={availableLights}
|
||||||
|
/>
|
||||||
|
</Form.Field>);
|
||||||
return (
|
return (
|
||||||
<StyledDiv onClick={this.onClickDevice} style={{textAlign: "center"}}>
|
<Form>
|
||||||
|
{deviceName}
|
||||||
|
{this.state.typeOfDevice === "sensor" ? (sensorForm) : ""}
|
||||||
|
{this.state.typeOfDevice === "switch" || this.state.typeOfDevice === "dimmer" ?
|
||||||
|
(switchDimmerOptions) : ""
|
||||||
|
}
|
||||||
|
</Form>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
const steps = [step1, step2()];
|
||||||
|
return (
|
||||||
|
<Modal closeIcon open={this.state.openModal} onClose={this.resetState} trigger={<StyledDiv onClick={this.handleOpen}>
|
||||||
<Image src="/img/add.svg" style={{filter: "invert()"}}/>
|
<Image src="/img/add.svg" style={{filter: "invert()"}}/>
|
||||||
{this.state.openForm ? (
|
</StyledDiv>} centered={true}>
|
||||||
<NewDeviceForm/>
|
<Modal.Header>Add a New Device</Modal.Header>
|
||||||
|
<Modal.Content>
|
||||||
|
{steps[this.state.step -1]}
|
||||||
|
</Modal.Content>
|
||||||
|
<Modal.Actions>
|
||||||
|
{this.state.step > 1 ? (
|
||||||
|
<Button onClick={this.previousStep} color="blue" icon labelPosition='left'>
|
||||||
|
<Icon name='left arrow'/>
|
||||||
|
Back
|
||||||
|
</Button>
|
||||||
) : ""}
|
) : ""}
|
||||||
</StyledDiv>
|
{this.state.step < steps.length ? (
|
||||||
|
<Button color="blue" onClick={this.nextStep} icon labelPosition='right'>
|
||||||
|
Next
|
||||||
|
<Icon name='right arrow'/>
|
||||||
|
</Button>
|
||||||
|
) : ""}
|
||||||
|
{this.state.step === steps.length ? (
|
||||||
|
<Button onClick={this.createDevice} color="blue" icon labelPosition='right'>
|
||||||
|
<Icon name='up arrow'/>
|
||||||
|
Finish
|
||||||
|
</Button>
|
||||||
|
) : ""}
|
||||||
|
</Modal.Actions>
|
||||||
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
import React, {Component} from "react";
|
import React, {Component} from "react";
|
||||||
import {CircularInput, CircularProgress, CircularTrack} from "react-circular-input";
|
import {CircularInput, CircularProgress, CircularTrack} from "react-circular-input";
|
||||||
import {errorStyle, sensorText, style, valueStyle} from "./SensorStyle";
|
import {errorStyle, sensorText, style, valueStyle} from "./SensorStyle";
|
||||||
|
import Settings from "./DeviceSettings";
|
||||||
|
import {StyledDiv} from "./styleComponents";
|
||||||
|
|
||||||
export default class Light extends Component {
|
export default class Sensor extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -34,13 +36,18 @@ export default class Light extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
<StyledDiv>
|
||||||
|
<Settings
|
||||||
|
deviceId={this.props.device.id}
|
||||||
|
edit={this.props.edit}
|
||||||
|
onChangeData={(id, newSettings) => this.props.onChangeData(id, newSettings)}/>
|
||||||
|
|
||||||
<CircularInput
|
<CircularInput
|
||||||
value={this.state.value / 100}
|
value={this.state.value / 100}
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
<CircularTrack/>
|
<CircularTrack/>
|
||||||
<CircularProgress/>
|
<CircularProgress/>
|
||||||
|
|
||||||
<text style={valueStyle} x={100} y={80} textAnchor="middle" dy="0.3em" fontWeight="bold">
|
<text style={valueStyle} x={100} y={80} textAnchor="middle" dy="0.3em" fontWeight="bold">
|
||||||
{Math.round(this.state.value)}{this.units}
|
{Math.round(this.state.value)}{this.units}
|
||||||
</text>
|
</text>
|
||||||
|
@ -51,6 +58,7 @@ export default class Light extends Component {
|
||||||
{this.setName()}
|
{this.setName()}
|
||||||
</text>
|
</text>
|
||||||
</CircularInput>
|
</CircularInput>
|
||||||
|
</StyledDiv>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
68
smart-hut/src/components/dashboard/devices/SettingsModal.js
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
import React, {Component, useState} from 'react';
|
||||||
|
import {Button, Checkbox, Form, Modal} from "semantic-ui-react";
|
||||||
|
|
||||||
|
const SettingsForm = (props) => {
|
||||||
|
|
||||||
|
const handleInputChange = e => {
|
||||||
|
const {name, value} = e.target;
|
||||||
|
setValues({...values, [name]: value})
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCheckboxChange = (e,d) => {
|
||||||
|
const {name, checked} = d;
|
||||||
|
setValues({...values, [name]: checked})
|
||||||
|
};
|
||||||
|
|
||||||
|
const [values, setValues] = useState({name: ''});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Form>
|
||||||
|
<Form.Field>
|
||||||
|
<label>New Name: </label>
|
||||||
|
<input autoComplete="off" name="name" onChange={handleInputChange} value={values.name} placeholder='Device name'/>
|
||||||
|
</Form.Field>
|
||||||
|
{props.type === "smart-plug" ? (
|
||||||
|
<Form.Field>
|
||||||
|
<Checkbox slider name={"reset"} onClick={handleCheckboxChange} label='Reset Energy Consumption'/>
|
||||||
|
</Form.Field>
|
||||||
|
) : ""}
|
||||||
|
<Button onClick={() => props.saveFunction(values)} color="blue" type='submit'>Save</Button>
|
||||||
|
</Form>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class SettingsModal extends Component {
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
open: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClose = () => {
|
||||||
|
this.setState({open: false});
|
||||||
|
};
|
||||||
|
|
||||||
|
saveSettings = (device) => {
|
||||||
|
// TODO Here there should be all the connections to save the data in the backend
|
||||||
|
console.log("SAVED: ", device);
|
||||||
|
|
||||||
|
this.props.openModal();
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const SettingsModal = () => (
|
||||||
|
<Modal open={true} onOpen={this.props.openModal} onClose={this.props.openModal}>
|
||||||
|
<Modal.Header>Settings of {this.props.device.name}</Modal.Header>
|
||||||
|
<Modal.Content>
|
||||||
|
<SettingsForm type={this.props.device.type} saveFunction={this.saveSettings}/>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<SettingsModal/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,18 +1,14 @@
|
||||||
/**
|
/**
|
||||||
|
|
||||||
A smart plug is a plug that has a boolean internal state, i.e., that can be turned on or off, either with the
|
A smart plug is a plug that has a boolean internal state, i.e., that can be turned on or off, either with the
|
||||||
SmartHut interface or by a switch.
|
SmartHut interface or by a switch.
|
||||||
The smart plug also stores the total energy consumed while the plug is active, in terms of kilowatt-hours
|
The smart plug also stores the total energy consumed while the plug is active, in terms of kilowatt-hours 2(kWh) .
|
||||||
2
|
The user can reset this value.
|
||||||
(kWh) . The user can reset this value.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {iconStyle, nameStyle, StyledDiv} from "./styleComponents";
|
import {StyledDiv} from "./styleComponents";
|
||||||
import Settings from "./DeviceSettings";
|
import Settings from "./DeviceSettings";
|
||||||
import {Image} from "semantic-ui-react";
|
import {Image} from "semantic-ui-react";
|
||||||
import {energyConsumedStyle, imageStyle} from "./SmartPlugStyle";
|
import {energyConsumedStyle, imageStyle, nameStyle} from "./SmartPlugStyle";
|
||||||
|
|
||||||
export default class SmartPlug extends Component {
|
export default class SmartPlug extends Component {
|
||||||
constructor(props){
|
constructor(props){
|
||||||
|
@ -36,17 +32,12 @@ export default class SmartPlug extends Component {
|
||||||
return this.iconOff;
|
return this.iconOff;
|
||||||
};
|
};
|
||||||
|
|
||||||
resetEnergyConsumedValue = () => {
|
|
||||||
// In the settings form there must be an option to restore this value
|
|
||||||
// along with the rename feature.
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
}
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
return (
|
return (
|
||||||
<StyledDiv onClick={this.props.edit ? () => {} : this.onClickDevice} style={{textAlign: "center"}}>
|
<StyledDiv onClick={this.props.edit.mode ? () => {} : this.onClickDevice}>
|
||||||
<Settings
|
<Settings
|
||||||
deviceId={this.props.device.id}
|
deviceId={this.props.device.id}
|
||||||
edit={this.props.edit}
|
edit={this.props.edit}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {iconStyle} from "./styleComponents";
|
import {iconStyle} from "./styleComponents";
|
||||||
|
|
||||||
export const energyConsumedStyle = {
|
export const energyConsumedStyle = {
|
||||||
|
color : "black",
|
||||||
fontSize : "1.3rem",
|
fontSize : "1.3rem",
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: "30%",
|
top: "30%",
|
||||||
|
@ -17,3 +18,11 @@ export const imageStyle = {
|
||||||
transform: "translateX(-50%)",
|
transform: "translateX(-50%)",
|
||||||
filter: "drop-shadow( 1px 1px 0.5px rgba(0, 0, 0, .25))"
|
filter: "drop-shadow( 1px 1px 0.5px rgba(0, 0, 0, .25))"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const nameStyle = {
|
||||||
|
color : "black",
|
||||||
|
position: "absolute",
|
||||||
|
top: "50%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translateX(-50%)"
|
||||||
|
};
|
||||||
|
|
56
smart-hut/src/components/dashboard/devices/Switch.js
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/**
|
||||||
|
* Users can add on-off switches. A on-off switch can turn on (or off) lights.
|
||||||
|
* If a light has an intensity level, when it gets switched back on, it gets the last available
|
||||||
|
* intensity level that was set by the user (or 100% if no such level exists).
|
||||||
|
* The user can change the state of a switch through the SmartHut interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React, {Component} from 'react';
|
||||||
|
import {StyledDiv} from "./styleComponents";
|
||||||
|
import Settings from "./DeviceSettings";
|
||||||
|
import {Image} from "semantic-ui-react";
|
||||||
|
import {imageStyle, nameStyle} from "./SwitchStyle";
|
||||||
|
|
||||||
|
export default class Switch extends Component {
|
||||||
|
constructor(props){
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
turnedOn: false,
|
||||||
|
pointingLights : []
|
||||||
|
};
|
||||||
|
this.iconOn = "/img/switchOn.svg";
|
||||||
|
this.iconOff = "/img/switchOff.svg";
|
||||||
|
}
|
||||||
|
|
||||||
|
onClickDevice = () => {
|
||||||
|
this.setState((prevState) => ({turnedOn: !prevState.turnedOn}));
|
||||||
|
};
|
||||||
|
|
||||||
|
getIcon = () => {
|
||||||
|
if(this.state.turnedOn){
|
||||||
|
return this.iconOn;
|
||||||
|
}
|
||||||
|
return this.iconOff;
|
||||||
|
};
|
||||||
|
|
||||||
|
resetEnergyConsumedValue = () => {
|
||||||
|
// In the settings form there must be an option to restore this value
|
||||||
|
// along with the rename feature.
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
return (
|
||||||
|
<StyledDiv onClick={this.props.edit.mode ? () => {} : this.onClickDevice}>
|
||||||
|
<Settings
|
||||||
|
deviceId={this.props.device.id}
|
||||||
|
edit={this.props.edit}
|
||||||
|
onChangeData={(id, newSettings) => this.props.onChangeData(id, newSettings)}/>
|
||||||
|
<Image src={this.getIcon()} style={imageStyle}/>
|
||||||
|
<h5 style={nameStyle}>{this.props.device.name}</h5>
|
||||||
|
</StyledDiv>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
17
smart-hut/src/components/dashboard/devices/SwitchStyle.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
export const imageStyle = {
|
||||||
|
width: "4.5rem",
|
||||||
|
height: "auto",
|
||||||
|
position: "absolute",
|
||||||
|
top: "15%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translateX(-50%)",
|
||||||
|
filter: "drop-shadow( 1px 1px 0.5px rgba(0, 0, 0, .25))"
|
||||||
|
};
|
||||||
|
|
||||||
|
export const nameStyle = {
|
||||||
|
color : "black",
|
||||||
|
position: "absolute",
|
||||||
|
top: "45%",
|
||||||
|
left: "50%",
|
||||||
|
transform: "translateX(-50%)"
|
||||||
|
};
|
|
@ -16,10 +16,9 @@ export const editButtonStyle = {
|
||||||
export const panelStyle = {
|
export const panelStyle = {
|
||||||
position : "relative",
|
position : "relative",
|
||||||
backgroundColor: "#fafafa",
|
backgroundColor: "#fafafa",
|
||||||
height: "100%",
|
height: "100vh",
|
||||||
width: "auto",
|
width: "auto",
|
||||||
padding: "3rem",
|
padding: "0rem 3rem",
|
||||||
color: "#000"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const editModeStyle = {
|
export const editModeStyle = {
|
||||||
|
@ -30,7 +29,8 @@ export const editModeStyle = {
|
||||||
height : "1.5rem",
|
height : "1.5rem",
|
||||||
backgroundColor : "black",
|
backgroundColor : "black",
|
||||||
borderRadius: "100%",
|
borderRadius: "100%",
|
||||||
zIndex : "100"
|
zIndex : "1000",
|
||||||
|
cursor : "pointer",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const editModeIconStyle = {
|
export const editModeIconStyle = {
|
||||||
|
@ -89,6 +89,7 @@ export const StyledDiv = styled.div`
|
||||||
position : relative;
|
position : relative;
|
||||||
box-shadow: 3px 2px 10px 5px #ccc;
|
box-shadow: 3px 2px 10px 5px #ccc;
|
||||||
transition : all .3s ease-out;
|
transition : all .3s ease-out;
|
||||||
|
text-align : center;
|
||||||
:hover{
|
:hover{
|
||||||
background-color : #f2f2f2;
|
background-color : #f2f2f2;
|
||||||
}
|
}
|
||||||
|
|