Skip to content

Commit

Permalink
Minor UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
thelevicole committed Mar 24, 2018
1 parent fa5d023 commit 75aa6ac
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
18 changes: 10 additions & 8 deletions assets/javascripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
return false;
},
set: function() {
app.light = this.data.id;
app.light = this.data;

return false;
}
Expand All @@ -143,20 +143,22 @@
*/
Vue.component('color-picker', {
template: '#color-picker-template',
computed: {
light: function() {
return app.get_light( app.light );
}
},
methods: {
close: function() {
app.light = null;
return false;
}
},
computed: {
light: () => {
return app.light;
}
},
mounted: function() {
const light = this.light;

console.log(light);

var timing = false;

$(this.$el).LifxColorPicker({
Expand All @@ -177,10 +179,10 @@
timing = setTimeout(function() {

// Send updates to Lifx
connection.set_color('id:'+app.light, color.hue, color.saturation);
connection.set_color('id:'+light.id, color.hue, color.saturation);

// Update UI
app.update_light(app.light, {
app.update_light(light.id, {
color: {
hue: color.hue,
saturation: color.saturation
Expand Down
17 changes: 14 additions & 3 deletions assets/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,21 @@ header {
right: 0;
height: $header-height;
background: #141316;
text-align: right;
font-size: 0.75rem;
padding: 12px;
text-align: center;
font-size: 1rem;
height: 38px;
line-height: 38px;
-webkit-app-region: drag;
font-weight: bold;

a {
position: absolute;
top: 0;
right: 12px;
bottom: 0;
font-weight: normal;
font-size: 0.75rem;
}
}

.btn {
Expand Down
2 changes: 1 addition & 1 deletion css/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<div vue-app>

<header>
{{ light ? light.label : 'Lifx' }}
<a v-on:click.prevent="logout" v-if="access_token && lights.length">Logout</a>
</header>

Expand All @@ -29,6 +30,7 @@ <h3>An access token is required</h3>
<!-- List all lights -->
<div v-if="!light">
<div id="bulbs" class="text-center" v-if="lights.length">
<h1>Lights</h1>
<light-switch v-for="light in lights" :key="light.id" :data="light"/>
</div>
<h1 v-if="!lights.length" class="text-center text-white">Loading...</h1>
Expand Down
2 changes: 1 addition & 1 deletion js/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"devDependencies": {
"babel-core": "^6.26.0",
"electron": "~1.8.2",
"electron-packager": "^11.2.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^5.0.0",
"gulp-babel": "^7.0.1",
Expand Down

0 comments on commit 75aa6ac

Please sign in to comment.