diff --git a/web/src/app/css/app.css b/web/src/app/css/app.css index 52df71a..0c00d0e 100644 --- a/web/src/app/css/app.css +++ b/web/src/app/css/app.css @@ -220,6 +220,13 @@ main { position: relative; top: 2px; } +#meet-actions *[href*="actions.quiz"] .fa { + font-size: 2.5em; + filter: brightness(160%); + color: var(--clr_quiz) !important; + position: relative; + top: 2px; +} #meet-actions *[href*="actions.discard"] .fa { font-size: 1.8em; color: #ffd841 !important; diff --git a/web/src/app/js/pages/meet.js b/web/src/app/js/pages/meet.js index a69fbf9..75e61eb 100644 --- a/web/src/app/js/pages/meet.js +++ b/web/src/app/js/pages/meet.js @@ -202,6 +202,14 @@ app.pages.meet = { } }); }, + quiz: function() { + document.activeElement.blur(); + const current = app.pages.meet.dataCurrent(); + if (current === undefined || current === null || + typeof current.quiz_id !== 'string') + return app.toast.error(s('app.error.unknown_error')); + hashredir(`quiz/${current.quiz_id}`); + }, }, carousel: { _current: 0, @@ -220,6 +228,15 @@ app.pages.meet = { app.pages.meet.actions._hide(); else app.pages.meet.actions._show(); + if (typeof current.quiz_id === 'string') { + document.getElementById('meet-action-crush').style.display = 'none'; + document.getElementById('meet-action-quiz').style.removeProperty('display'); + app.template.load('quiz.index'); + } else { + document.getElementById('meet-action-crush').style.removeProperty('display'); + document.getElementById('meet-action-quiz').style.display = 'none'; + } + const trail = document.querySelector('#page-meet #trail'); const index = app.pages.meet.carousel._current; if (trail !== null) { diff --git a/web/src/app/js/pages/quiz.js b/web/src/app/js/pages/quiz.js index 2d23d30..2884646 100644 --- a/web/src/app/js/pages/quiz.js +++ b/web/src/app/js/pages/quiz.js @@ -20,7 +20,8 @@ app.pages.quiz = { await app.template.loadMany(['quiz.index']); app.pages.quiz.data = json; app.pages.quiz.paint(json); - if (getNormalizedURI() === app.vars.app_dir) + if (getNormalizedURI() === app.vars.app_dir && + window.prevHash === '') animateTimeout('#quiz', 'slide-from-right'); }; if (data === undefined) diff --git a/web/src/app/js/templates/meet/actions.html b/web/src/app/js/templates/meet/actions.html index 9046863..1b20568 100644 --- a/web/src/app/js/templates/meet/actions.html +++ b/web/src/app/js/templates/meet/actions.html @@ -14,12 +14,20 @@ -
+ +
+ +
+
diff --git a/web/src/config/lang/en.php b/web/src/config/lang/en.php index b66a3be..dfa8867 100644 --- a/web/src/config/lang/en.php +++ b/web/src/config/lang/en.php @@ -4,6 +4,7 @@ $strings = [ 'alt' => [ 'nav_crush' => 'Mark this person as your new crush!', 'nav_close' => 'Close this window', + 'action_quiz' => 'Fill the quiz requested by your crush', ], 'form' => [ 'login' => 'Log in', diff --git a/web/src/config/lang/es.php b/web/src/config/lang/es.php index 0615898..cbf8b45 100644 --- a/web/src/config/lang/es.php +++ b/web/src/config/lang/es.php @@ -4,6 +4,7 @@ $strings = [ 'alt' => [ 'nav_crush' => '¡Marcar a esta persona como tu nuevo crush!', 'nav_close' => 'Cerrar esta ventana', + 'action_quiz' => 'Rellena el quiz que te ha pedido tu crush', ], 'form' => [ 'login' => 'Iniciar sesión',