show deck description on congrats screen

This commit is contained in:
Damien Elmes 2021-02-06 13:20:06 +10:00
parent d3ea9b3532
commit 3839ed2e28
3 changed files with 10 additions and 0 deletions

View file

@ -1166,6 +1166,7 @@ message CongratsInfoOut {
bool have_user_buried = 6; bool have_user_buried = 6;
bool is_filtered_deck = 7; bool is_filtered_deck = 7;
bool bridge_commands_supported = 8; bool bridge_commands_supported = 8;
string deck_description = 9;
} }
message UnburyCardsInCurrentDeckIn { message UnburyCardsInCurrentDeckIn {

View file

@ -2,6 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::backend_proto as pb; use crate::backend_proto as pb;
use crate::decks::DeckKind;
use crate::prelude::*; use crate::prelude::*;
#[derive(Debug)] #[derive(Debug)]
@ -21,6 +22,11 @@ impl Collection {
let today = self.timing_today()?.days_elapsed; let today = self.timing_today()?.days_elapsed;
let info = self.storage.congrats_info(&deck, today)?; let info = self.storage.congrats_info(&deck, today)?;
let is_filtered_deck = deck.is_filtered(); let is_filtered_deck = deck.is_filtered();
let deck_description = if let DeckKind::Normal(normal) = &deck.kind {
normal.description.clone()
} else {
String::new()
};
let secs_until_next_learn = ((info.next_learn_due as i64) let secs_until_next_learn = ((info.next_learn_due as i64)
- self.learn_ahead_secs() as i64 - self.learn_ahead_secs() as i64
- TimestampSecs::now().0) - TimestampSecs::now().0)
@ -34,6 +40,7 @@ impl Collection {
is_filtered_deck, is_filtered_deck,
secs_until_next_learn, secs_until_next_learn,
bridge_commands_supported: true, bridge_commands_supported: true,
deck_description,
}) })
} }
} }

View file

@ -61,5 +61,7 @@
</p> </p>
{/if} {/if}
{/if} {/if}
{@html info.deckDescription}
</div> </div>
</div> </div>