feat(predlozhnik): wire up the actual предлог/вопрос matching
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 <tazjin@tvl.su>
This commit is contained in:
parent
134efdab25
commit
5134a4809f
1 changed files with 14 additions and 7 deletions
|
@ -30,12 +30,12 @@ impl Падеж {
|
||||||
fn вопрос(&self) -> &str {
|
fn вопрос(&self) -> &str {
|
||||||
use Падеж::*;
|
use Падеж::*;
|
||||||
match self {
|
match self {
|
||||||
Именительный => "Кто? Что?",
|
Именительный => "кто? Что?",
|
||||||
Родительный => "Кого? Чего?",
|
Родительный => "кого? Чего?",
|
||||||
Дательный => "Кому? Чему?",
|
Дательный => "кому? Чему?",
|
||||||
Винительный => "Кого? Что?",
|
Винительный => "кого? Что?",
|
||||||
Творительный => "Кем? Чем?",
|
Творительный => "кем? Чем?",
|
||||||
Предложный => "О ком? О чём?",
|
Предложный => "о ком? О чём?",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ struct Вывод {
|
||||||
|
|
||||||
fn объяснить(падеж: Падеж, предлог: &str) -> Html {
|
fn объяснить(падеж: Падеж, предлог: &str) -> Html {
|
||||||
html! {
|
html! {
|
||||||
{"NYI"}
|
{format!("{} {}", предлог, падеж.вопрос())}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,6 +260,11 @@ impl Component for Модель {
|
||||||
.map(|п| покажи_падеж(link, self, &вв, *п))
|
.map(|п| покажи_падеж(link, self, &вв, *п))
|
||||||
.collect::<Html>();
|
.collect::<Html>();
|
||||||
|
|
||||||
|
let объяснение = вв
|
||||||
|
.объяснение
|
||||||
|
.map(|s| html! {{s}})
|
||||||
|
.unwrap_or_else(|| html! {});
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
|
@ -275,6 +280,8 @@ impl Component for Модель {
|
||||||
{кнапки_падежов}
|
{кнапки_падежов}
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
|
{объяснение}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue