diff --git a/app/Http/Controllers/CurrentEventController.php b/app/Http/Controllers/CurrentEventController.php new file mode 100644 index 0000000..47ec21c --- /dev/null +++ b/app/Http/Controllers/CurrentEventController.php @@ -0,0 +1,54 @@ + 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')); + + } + +} diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 1b6c9d3..42b65d0 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -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'); diff --git a/config/app.php b/config/app.php index 05b259a..9841202 100644 --- a/config/app.php +++ b/config/app.php @@ -65,7 +65,7 @@ | */ - 'timezone' => 'UTC', + 'timezone' => 'Europe/Athens', /* |-------------------------------------------------------------------------- diff --git a/public/css/app.css b/public/css/app.css index ab35fb6..6ad9ffc 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -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 { @@ -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 { @@ -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; } @@ -14695,6 +14739,7 @@ article.license { margin-bottom: 3rem; } + article.home #hero.live, article.about, article.schedule, article.speakers, @@ -14864,6 +14909,7 @@ article.license { display: none; } + article.home #hero.live, article.about, article.schedule, article.speakers, @@ -15055,6 +15101,7 @@ article.license { width: 10%; } + article.home #hero.live, article.about, article.speakers, article.team, diff --git a/public/js/home-animations.js b/public/js/home-animations.js index 3b80108..0848f6d 100644 --- a/public/js/home-animations.js +++ b/public/js/home-animations.js @@ -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); }; /***/ }), diff --git a/resources/assets/js/home-animations.js b/resources/assets/js/home-animations.js index c8213f9..a569f60 100644 --- a/resources/assets/js/home-animations.js +++ b/resources/assets/js/home-animations.js @@ -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) } \ No newline at end of file diff --git a/resources/assets/sass/app.scss b/resources/assets/sass/app.scss index 9760372..5bf15bb 100644 --- a/resources/assets/sass/app.scss +++ b/resources/assets/sass/app.scss @@ -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; @@ -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; @@ -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; } } @@ -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 { @@ -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 { diff --git a/resources/lang/el/general.php b/resources/lang/el/general.php index 700e75f..e3646ff 100644 --- a/resources/lang/el/general.php +++ b/resources/lang/el/general.php @@ -113,6 +113,11 @@ 'desc' => 'Το TEDxNTUA 2018 θα διεξαχθεί στο Ευγενίδειο Πλανητάριο. Το Πλανητάριο βρίσκεται στη λεωφόρο Ανδρέα Συγγρού 387, μόλις λιγότερο από 7 λεπτά από τον πλησιέστερο σταθμό λεωφορείων. Πρόσβαση μέσω ΜΜΜ:
', ], ], + 'live' => [ + 'wearelive' => 'We are live!', + 'curr' => 'ΤΩΡΑ', + 'next' => 'ΕΠΟΜΕΝΟ', + ], ], /* SPONSORS */ diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php index d134783..1c560fb 100644 --- a/resources/lang/en/general.php +++ b/resources/lang/en/general.php @@ -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: ', ], ], + 'live' => [ + 'wearelive' => 'We are live!', + 'curr' => 'NOW', + 'next' => 'NEXT', + ], ], /* SPONSORS */ diff --git a/resources/views/api/currentEvent.twig b/resources/views/api/currentEvent.twig new file mode 100644 index 0000000..5b3fd3b --- /dev/null +++ b/resources/views/api/currentEvent.twig @@ -0,0 +1,37 @@ +{% if curr is not null or next is not null %} +