Refactor api.account to api.accounts + Added action.discard to quizs

This commit is contained in:
Niko 2022-02-27 13:44:32 +01:00
parent 8e1f2af662
commit 034963b258
7 changed files with 27 additions and 15 deletions

View File

@ -124,6 +124,10 @@ img.avatar {
top: -2px;
color: #fff;
}
.component.button.form > .center {
position: relative;
left: -.4em;
}
a.button {
text-decoration: none;
color: initial;

View File

@ -1,5 +1,5 @@
var api = {
account: {
accounts: {
block: function(url, cback) {
cback = cback || function() {};
http.post(`/api/v1/accounts/block?url=${url}`, {}, function(json) {

View File

@ -181,7 +181,7 @@ app.pages.meet = {
const current = app.pages.meet.dataCurrent();
if (current === undefined || current === null)
return app.toast.error(s('app.error.unknown_error'));
api.account.block(current.account.url, function(json) {
api.accounts.block(current.account.url, function(json) {
setTimeout(function() {
for (var i = app.pages.meet.data.length-1; i >= 0; i--)
if (app.pages.meet.data[i].account.url === current.account.url)

View File

@ -149,7 +149,12 @@ app.pages.quiz = {
},
actions: {
discard: function() {
console.log('DISCARD');
const dt = page().data;
if (dt.from === undefined)
return; // TODO: add unknown error?
api.accounts.block(dt.from.url, function(json) {
setTimeout(function(){ exit() }, app.toast.DEFAULT_MILLIS);
});
},
send: function() {
console.log('SEND');

View File

@ -55,22 +55,21 @@
<br>
<div class="flex width-max">
<div class="flex center width-max" style="max-width: 32em">
<div class="flex width-max" style="padding: 0 .4em">
<a class="component button form rounder2 card-item flex width-max"
style="background-color: $clr_button_yellow"
onclick="page().actions.discard()">
<span class="center">
<i class="fa fa-close fa-fw"></i>{s:app.discard}
</span>
</a>
<div style="max-width: 1.5em" class="width-max"></div>
<a class="component button form rounder2 card-item flex width-max"
<div class="width-max" style="padding: 0 1.2em">
<div class="component button form rounder card-item"
style="background-color: $clr_button_green"
onclick="page().actions.send()">
<span class="center">
<i class="fa fa-send fa-fw"></i>{s:app.send}
<i class="fa fa-send fa-fw"></i>{s:app.send_quiz}
</span>
</a>
</div>
<div class="component button form rounder card-item"
style="background-color: $clr_button_yellow"
onclick="page().actions.discard()">
<span class="center">
<i class="fa fa-close fa-fw"></i>{s:app.not_interested}
</span>
</div>
</div>
</div>
</div>

View File

@ -27,6 +27,8 @@ $strings = [
'questions' =< 'questions',
'send' => 'Send',
'discard' => 'Discard',
'send_quiz' => 'Send Quiz!',
'not_interested' => 'No longer interested',
'nav' => [
'meet' => 'Meet',
'crushes' => 'Your crushes',

View File

@ -27,6 +27,8 @@ $strings = [
'questions' => 'preguntas',
'send' => 'Enviar',
'discard' => 'Descartar',
'send_quiz' => '¡Enviar Quiz!',
'not_interested' => 'Ya no me interesa',
'nav' => [
'meet' => 'Conoce',
'crushes' => 'Tus crush',