From 5134a4809f7dfe2b7e10b08f2b90881ec2f34648 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 27 Jul 2022 23:07:40 +0300 Subject: feat(predlozhnik): wire up the actual предлог/вопрос matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit with this commit the application is sort of functional-ish as intended. users can select either cases or prepositions, have the remaining choices appropriately constrained, and get the right question (i.e. case) matching when selecting both. there should be some explanatory translations and it needs to be prettier, but this kind of does what I wanted. Change-Id: If5bdaa7f93235dc267bf38cf13c2029f44d68415 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5984 Tested-by: BuildkiteCI Reviewed-by: tazjin --- users/tazjin/predlozhnik/src/main.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'users/tazjin') diff --git a/users/tazjin/predlozhnik/src/main.rs b/users/tazjin/predlozhnik/src/main.rs index 65c11f07db28..0e5f7204e55b 100644 --- a/users/tazjin/predlozhnik/src/main.rs +++ b/users/tazjin/predlozhnik/src/main.rs @@ -30,12 +30,12 @@ impl Падеж { fn вопрос(&self) -> &str { use Падеж::*; match self { - Именительный => "Кто? Что?", - Родительный => "Кого? Чего?", - Дательный => "Кому? Чему?", - Винительный => "Кого? Что?", - Творительный => "Кем? Чем?", - Предложный => "О ком? О чём?", + Именительный => "кто? Что?", + Родительный => "кого? Чего?", + Дательный => "кому? Чему?", + Винительный => "кого? Что?", + Творительный => "кем? Чем?", + Предложный => "о ком? О чём?", } } } @@ -142,7 +142,7 @@ struct Вывод { fn объяснить(падеж: Падеж, предлог: &str) -> Html { html! { - {"NYI"} + {format!("{} {}", предлог, падеж.вопрос())} } } @@ -260,6 +260,11 @@ impl Component for Модель { .map(|п| покажи_падеж(link, self, &вв, *п)) .collect::(); + let объяснение = вв + .объяснение + .map(|s| html! {{s}}) + .unwrap_or_else(|| html! {}); + html! { <>
+ + {объяснение} } } -- cgit 1.4.1