Skip to content

Commit

Permalink
Fix live stream size on s on medium 16:9 screens; Add live info section
Browse files Browse the repository at this point in the history
  • Loading branch information
tdiam committed Mar 22, 2018
1 parent 6ed3fc7 commit e83f8d7
Show file tree
Hide file tree
Showing 12 changed files with 238 additions and 9 deletions.
54 changes: 54 additions & 0 deletions app/Http/Controllers/CurrentEventController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use LaravelLocalization;
use App\Schedule;

class CurrentEventController extends Controller {

private $now;

private function getCurr($events) {
$coll = $events -> where('hour', '<=', $this->now);
$last = $coll -> pop();
$prevToLast = $coll -> last();
while(!is_null($last) && $coll -> isNotEmpty() && $last -> hour == $prevToLast -> hour) {
if($last -> type != "general" && $prevToLast -> type == "general") {
$coll -> pop();
$coll -> push($last);
}
$last = $coll -> pop();
$prevToLast = $coll -> last();
}
return $last;
}

private function getNext($events) {
$next = $events -> where('hour', '>', $this->now) -> whereIn('type', ['talk', 'performance']) -> first();
return $next;
}

public function __construct() {
$this->now = '15:35';#date('H:i');
}

public function index(Request $request) {

if(env('SHOW_HIDDEN_ENTRIES', false) == true) {
$where = [];
} else {
$where = [['visible', true]];
}

$events = Schedule :: where(array_merge($where, [['type', '!=', 'workshop']]))
-> orderBy('hour', 'asc')
-> get();

$curr = $this->getCurr($events);
$next = $this->getNext($events);
return view('api/currentEvent', compact('curr', 'next'));

}

}
2 changes: 1 addition & 1 deletion app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function index(Request $request) {
}

$speakers = $query->get()->sortByAppearance();
$now = date("Y-m-d H:m");
$now = date("Y-m-d H:i");
$isToday = $request->testLive == "yes" || ($now >= "2018-03-24 10:30" && $now <= "2018-03-24 21:00");

$isPjax = $request->header('X-PJAX');
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
|
*/

'timezone' => 'UTC',
'timezone' => 'Europe/Athens',

/*
|--------------------------------------------------------------------------
Expand Down
51 changes: 49 additions & 2 deletions public/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -13728,6 +13728,7 @@ article.home #hero svg#logo-animation .secondary {
article.home #hero.live {
position: static;
height: auto;
font-size: .85rem;
}

article.home #hero.live .section-content {
Expand All @@ -13736,8 +13737,53 @@ article.home #hero.live .section-content {
padding-top: 5.2rem;
}

article.home #hero.live h2 {
font-size: 3em;
margin-bottom: .2em;
}

article.home #hero.live .liveInfo {
width: 100%;
max-width: 540px;
margin: 0 auto;
text-align: center;
}

article.home #hero.live .liveInfo h4 {
color: #E62B1E;
font-size: 1.2em;
margin-bottom: .25em;
}

article.home #hero.live .liveInfo h5 {
font-size: 1em;
}

article.home #hero.live .liveInfo h6 {
margin-top: .15rem;
font-weight: normal;
font-size: .8em;
}

article.home #hero.live .liveInfo h5,
article.home #hero.live .liveInfo h6,
article.home #hero.live .liveInfo p {
margin-bottom: 0;
}

article.home #hero.live .liveInfo .container-fluid {
margin-bottom: 1.2em;
}

article.home #hero.live .liveInfo .col:not(:last-child) {
border-right: 1px solid #999;
}

article.home #hero.live .live-container {
overflow: visible;
width: 80vw;
max-width: 100%;
margin: 0 auto;
}

article.home #hero.live .live-container .close {
Expand All @@ -13762,8 +13808,6 @@ article.home #hero.live.popup .live-container {
right: 3vw;
width: 39vw;
max-width: 576px;
-webkit-box-shadow: 0 0 30px 8px #FFF;
box-shadow: 0 0 30px 8px #FFF;
z-index: 9998;
}

Expand Down Expand Up @@ -14695,6 +14739,7 @@ article.license {
margin-bottom: 3rem;
}

article.home #hero.live,
article.about,
article.schedule,
article.speakers,
Expand Down Expand Up @@ -14864,6 +14909,7 @@ article.license {
display: none;
}

article.home #hero.live,
article.about,
article.schedule,
article.speakers,
Expand Down Expand Up @@ -15055,6 +15101,7 @@ article.license {
width: 10%;
}

article.home #hero.live,
article.about,
article.speakers,
article.team,
Expand Down
22 changes: 22 additions & 0 deletions public/js/home-animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,28 @@ window.homeAnimations = function () {
$("#hero .section-content").addClass("slideIn");
}, 5000);
}

var update = function update() {
if ($("#live").length > 0) {
$.ajax({
type: "GET",
url: "/currentEvent",
dataType: "html",
success: function success(data) {
if (data != $("#hero .liveInfo").html()) {
$("#hero .liveInfo").fadeOut(200, function () {
$(this).html(data).fadeIn();
});
}
},
error: function error(xhr, textStatus, _error) {
$("#hero .liveInfo").html("");
}
});
liveWI = window.setTimeout(update, 10000);
}
};
var liveWI = window.setTimeout(update, 400);
};

/***/ }),
Expand Down
22 changes: 22 additions & 0 deletions resources/assets/js/home-animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,26 @@ window.homeAnimations = function() {
$("#hero .section-content").addClass("slideIn")
}, 5000)
}

let update = function() {
if($("#live").length > 0) {
$.ajax({
type: "GET",
url: "/currentEvent",
dataType: "html",
success: function(data) {
if(data != $("#hero .liveInfo").html()) {
$("#hero .liveInfo").fadeOut(200, function() {
$(this).html(data).fadeIn()
})
}
},
error: function(xhr, textStatus, error) {
$("#hero .liveInfo").html("")
}
})
liveWI = window.setTimeout(update, 10000)
}
}
let liveWI = window.setTimeout(update, 400)
}
43 changes: 39 additions & 4 deletions resources/assets/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -796,13 +796,49 @@ article.home {
&.live {
position: static;
height: auto;
font-size: .85rem;
.section-content {
position: static;
/* outer height of nav = 4rem (height) + 1.2rem (padding) = 5.2rem */
padding-top: 5.2rem;
}
h2 {
font-size: 3em;
margin-bottom: .2em;
}
.liveInfo {
width: 100%;
max-width: 540px;
margin: 0 auto;
text-align: center;
h4 {
color: $brand-primary;
font-size: 1.2em;
margin-bottom: .25em;
}
h5 {
font-size: 1em;
}
h6 {
margin-top: .15rem;
font-weight: normal;
font-size: .8em;
}
h5, h6, p {
margin-bottom: 0;
}
.container-fluid {
margin-bottom: 1.2em;
}
.col:not(:last-child) {
border-right: 1px solid #999;
}
}
.live-container {
overflow: visible;
width: 80vw;
max-width: 100%;
margin: 0 auto;
.close {
display: none;
position: absolute;
Expand All @@ -825,7 +861,6 @@ article.home {
right: 3vw;
width: 39vw;
max-width: 576px;
box-shadow: 0 0 30px 8px #FFF;
z-index: 9998;
iframe#live {
opacity: .9;
Expand Down Expand Up @@ -1593,7 +1628,7 @@ article.privacy, article.license {
margin-bottom: 3rem;
}
}
article.about, article.schedule, article.speakers, article.team, article.privacy, article.license {
article.home #hero.live, article.about, article.schedule, article.speakers, article.team, article.privacy, article.license {
font-size: .9rem;
}
}
Expand Down Expand Up @@ -1734,7 +1769,7 @@ article.privacy, article.license {
display: none;
}
}
article.about, article.schedule, article.speakers, article.team, article.privacy, article.license {
article.home #hero.live, article.about, article.schedule, article.speakers, article.team, article.privacy, article.license {
font-size: 1rem;
}
.blog-listing {
Expand Down Expand Up @@ -1884,7 +1919,7 @@ article.privacy, article.license {
width: 10%;
}
}
article.about, article.speakers, article.team, article.privacy, article.license {
article.home #hero.live, article.about, article.speakers, article.team, article.privacy, article.license {
font-size: 1.1rem;
}
article.contact {
Expand Down
5 changes: 5 additions & 0 deletions resources/lang/el/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
'desc' => 'Το TEDxNTUA 2018 θα διεξαχθεί στο Ευγενίδειο Πλανητάριο. Το Πλανητάριο βρίσκεται στη λεωφόρο Ανδρέα Συγγρού 387, μόλις λιγότερο από 7 λεπτά από τον πλησιέστερο σταθμό λεωφορείων. Πρόσβαση μέσω ΜΜΜ: <ul><li>550, Β2 (στάση <a href="http://telematics.oasa.gr/#stationInfo_240009_%CE%A9%CE%9D%CE%91%CE%A3%CE%95%CE%99%CE%9F_37.9423944,23.6978659" target="_blank">ΩΝΑΣΕΙΟ</a>)</li><li>Α2 (στάση <a href="http://telematics.oasa.gr/#stationInfo_380002_%CE%99%CE%91%CE%A3%CE%A9%CE%9D%CE%9F%CE%A3_37.9399224,23.700599" target="_blank">ΙΑΣΩΝΟΣ</a>)</li></ul>',
],
],
'live' => [
'wearelive' => 'We are live!',
'curr' => 'ΤΩΡΑ',
'next' => 'ΕΠΟΜΕΝΟ',
],
],

/* SPONSORS */
Expand Down
5 changes: 5 additions & 0 deletions resources/lang/en/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@
'desc' => 'TEDxNTUA 2018 will take place at the Athens Planetarium. The Planetarium is located at 387 Syggrou Avenue, just under 7 minutes on foot from the nearest bus station. Access via public transport: <ul><li>550, B2 (<a href="http://telematics.oasa.gr/en/#stationInfo_240009_%CE%A9%CE%9D%CE%91%CE%A3%CE%95%CE%99%CE%9F_37.9423944,23.6978659" target="_blank">ONASEIO</a> stop)</li><li>A2 (<a href="http://telematics.oasa.gr/en/#stationInfo_380002_%CE%99%CE%91%CE%A3%CE%A9%CE%9D%CE%9F%CE%A3_37.9399224,23.700599" target="_blank">IASONOS</a> stop)</li></ul>',
],
],
'live' => [
'wearelive' => 'We are live!',
'curr' => 'NOW',
'next' => 'NEXT',
],
],

/* SPONSORS */
Expand Down
37 changes: 37 additions & 0 deletions resources/views/api/currentEvent.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% if curr is not null or next is not null %}
<div class="container-fluid">
<div class="row">
{% if curr is not null %}
{% if next is not null %}
<div class="col col-6">
<h4>{{ trans('general.home.live.curr') }}</h4>
<h5>{{ curr.event_title | raw }}</h5>
<h6>{{ curr.event_prev | markdown }}</h6>
</div>
{% else %}
<div class="col col-12">
<h4>{{ trans('general.home.live.curr') }}</h4>
<h5>{{ curr.event_title | raw }}</h5>
{{ curr.event_prev | markdown }}
</div>
{% endif %}
{% endif %}

{% if next is not null %}
{% if curr is not null %}
<div class="col col-6">
<h4>{{ trans('general.home.live.next') }}</h4>
<h5>{{ next.event_title | raw }}</h5>
<h6>{{ next.event_prev | markdown }}</h6>
</div>
{% else %}
<div class="col col-12">
<h4>{{ trans('general.home.live.next') }}</h4>
<h5>{{ next.event_title | raw }}</h5>
<h6>{{ next.event_prev | markdown }}</h6>
</div>
{% endif %}
{% endif %}
</div>
</div>
{% endif %}
3 changes: 2 additions & 1 deletion resources/views/home.twig
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
<section id="hero" class="live">

<div class="section-content">
<h2 class="mt-3">We are live!</h2>
<h2 class="mt-3">{{ trans('general.home.live.wearelive') }}</h2>
<div class="liveInfo"></div>
<div class="live-container embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" id="live" src="https://www.youtube.com/embed/P11y8N22Rq0?ecver=1&autoplay=1" allow="encrypted-media" allowfullscreen></iframe>
<button type="button" class="close" aria-label="Close">
Expand Down
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
Route::get('/license', ['as' => 'license', 'uses' => 'LicenseController@index']);
Route::get('/privacy', ['as' => 'privacy', 'uses' => 'PrivacyController@index']);
Route::get('/tickets', ['as' => 'tickets', 'uses' => 'TicketsController@index']);
Route::get('/currentEvent', ['as' => 'currentEvent', 'uses' => 'CurrentEventController@index']);
});

0 comments on commit e83f8d7

Please sign in to comment.