Browse Source

dismiss scoreboard when another tweet is clicked, ping dashboard to help timeouts

master
Aaron Parecki 7 years ago
parent
commit
2c8bf4d175
No known key found for this signature in database GPG Key ID: 276C2817346D6056
7 changed files with 55 additions and 29 deletions
  1. +5
    -0
      app/Http/Controllers/DashboardController.php
  2. +10
    -0
      public/css/app.css
  3. +15
    -16
      public/js/app.js
  4. +4
    -11
      resources/assets/js/components/Scorecard.vue
  5. +13
    -1
      resources/assets/js/components/TweetQueue.vue
  6. +7
    -1
      resources/assets/sass/app.scss
  7. +1
    -0
      routes/web.php

+ 5
- 0
app/Http/Controllers/DashboardController.php View File

@ -42,6 +42,11 @@ class DashboardController extends Controller
return response()->json(['queue'=>$queue]);
}
public function ping() {
Tweet::claimed_timeout();
return response()->json(['result'=>'ok']);
}
public function claim_tweet(Request $request) {
$tweet = Tweet::where('id', $request->input('tweet_id'))->first();
if($tweet) {

+ 10
- 0
public/css/app.css View File

@ -8586,6 +8586,11 @@ button.close {
max-width: 100%;
}
.multi-photo {
overflow: hidden;
border-radius: 6px;
}
.multi-photo .photo {
position: relative;
overflow: hidden;
@ -8608,6 +8613,11 @@ button.close {
clear: both;
}
.multi-photo.photos-1 .photo {
width: 100%;
height: 400px;
}
/* 2-up multi-photos use this layout */
.multi-photo.photos-2 .photo {

+ 15
- 16
public/js/app.js View File

@ -46538,6 +46538,13 @@ module.exports = {
});
}.bind(this));
},
dashboardPing: function dashboardPing() {
setTimeout(function () {
$.get('/dashboard/ping', function () {
this.dashboardPing();
}.bind(this));
}.bind(this), 15000);
},
findTweetInQueue: function findTweetInQueue(tweet_id) {
var queueIndex = false;
for (var i in this.queue) {
@ -46555,7 +46562,11 @@ module.exports = {
}
},
clickedTweet: function clickedTweet(tweet_index) {
// var tweet_data = this.removeTweetFromQueue(tweet_id);
// If another tweet was already open, dismiss that first
if (this.show) {
this.dismissTweet();
}
var tweet_data = this.queue[tweet_index];
var tweet_id = tweet_data.tweet_id;
@ -46589,6 +46600,7 @@ module.exports = {
},
created: function created() {
this.loadQueue();
this.dashboardPing();
}
};
@ -46737,13 +46749,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "tweet"
}, [_c('div', {
staticClass: "text"
}, [_vm._v(_vm._s(_vm.tweet.text))]), _vm._v(" "), (_vm.tweet.photos) ? _c('div', [(_vm.tweet.photos.length == 1) ? _vm._l((_vm.tweet.photos), function(img) {
return _c('div', [_c('img', {
attrs: {
"src": img
}
})])
}) : [(_vm.tweet.photos) ? _c('div', {
}, [_vm._v(_vm._s(_vm.tweet.text))]), _vm._v(" "), (_vm.tweet.photos) ? _c('div', [(_vm.tweet.photos) ? _c('div', {
class: 'multi-photo photos-' + _vm.tweet.photos.length
}, _vm._l((_vm.tweet.photos), function(img) {
return _c('div', {
@ -46759,7 +46765,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
})])
})) : _vm._e(), _vm._v(" "), _c('div', {
staticClass: "multi-photo-clear"
})]], 2) : _vm._e()])]), _vm._v(" "), _c('div', {
})]) : _vm._e()])]), _vm._v(" "), _c('div', {
staticClass: "col-md-4"
}, [_c('div', [_vm._v(_vm._s(_vm.tweet.mission))])])])])]) : _vm._e()
},staticRenderFns: []}
@ -46775,13 +46781,6 @@ if (false) {
/* 61 */
/***/ (function(module, exports) {
//
//
//
//
//
//
//
//
//
//

+ 4
- 11
resources/assets/js/components/Scorecard.vue View File

@ -21,19 +21,12 @@
<div class="tweet">
<div class="text">{{ tweet.text }}</div>
<div v-if="tweet.photos">
<template v-if="tweet.photos.length == 1">
<div v-for="img in tweet.photos">
<div :class="'multi-photo photos-'+tweet.photos.length" v-if="tweet.photos">
<div v-for="img in tweet.photos" class="photo" :style="'background-image:url('+img+')'" :data-featherlight="img">
<img :src="img">
</div>
</template>
<template v-else>
<div :class="'multi-photo photos-'+tweet.photos.length" v-if="tweet.photos">
<div v-for="img in tweet.photos" class="photo" :style="'background-image:url('+img+')'" :data-featherlight="img">
<img :src="img">
</div>
</div>
<div class="multi-photo-clear"></div>
</template>
</div>
<div class="multi-photo-clear"></div>
</div>
</div>

+ 13
- 1
resources/assets/js/components/TweetQueue.vue View File

@ -52,6 +52,13 @@ module.exports = {
}.bind(this));
},
dashboardPing() {
setTimeout(function(){
$.get('/dashboard/ping', function(){
this.dashboardPing();
}.bind(this));
}.bind(this), 15000);
},
findTweetInQueue(tweet_id) {
var queueIndex = false;
for(var i in this.queue) {
@ -69,7 +76,11 @@ module.exports = {
}
},
clickedTweet(tweet_index) {
// var tweet_data = this.removeTweetFromQueue(tweet_id);
// If another tweet was already open, dismiss that first
if(this.show) {
this.dismissTweet();
}
var tweet_data = this.queue[tweet_index];
var tweet_id = tweet_data.tweet_id;
@ -106,6 +117,7 @@ module.exports = {
},
created() {
this.loadQueue();
this.dashboardPing();
}
}
</script>

+ 7
- 1
resources/assets/sass/app.scss View File

@ -110,8 +110,10 @@
}
.multi-photo {
overflow: hidden;
border-radius: 6px;
.photo {
position: relative;
overflow: hidden;
@ -135,6 +137,10 @@
.multi-photo-clear {
clear: both;
}
.multi-photo.photos-1 .photo {
width: 100%;
height: 400px;
}
/* 2-up multi-photos use this layout */
.multi-photo.photos-2 .photo {
width: 50%;

+ 1
- 0
routes/web.php View File

@ -19,6 +19,7 @@ Auth::routes();
Route::get('/dashboard', 'DashboardController@index')->name('dashboard');
Route::get('/dashboard/queue', 'DashboardController@queue')->name('queue');
Route::get('/dashboard/ping', 'DashboardController@ping');
Route::post('/dashboard/claim-tweet', 'DashboardController@claim_tweet');
Route::get('/teams', 'TeamController@index')->name('teams');

Loading…
Cancel
Save