From e4cf8ffafcc94ec73bc93b6f5f5790afe3a6d83e Mon Sep 17 00:00:00 2001 From: BrewingWeasel Date: Wed, 17 Jan 2024 14:34:39 -0800 Subject: [PATCH] feat(ui): move definition and word info to side --- src-ui/src/reader.rs | 273 ++++++++++++++++++++++--------------------- src-ui/style.css | 32 ++++- 2 files changed, 166 insertions(+), 139 deletions(-) diff --git a/src-ui/src/reader.rs b/src-ui/src/reader.rs index 5b98d8f..a64a58c 100644 --- a/src-ui/src/reader.rs +++ b/src-ui/src/reader.rs @@ -126,162 +126,163 @@ pub fn ReaderView() -> impl IntoView {
- {move || { - if selected_word().is_some() { - view! { -
- + {move || { + if selected_word().is_some() { + view! { +
+ + +
+ +
+ {move || { + conts .get() - .and_then(|i| { - let words = conts.get().unwrap(); - words.get(i).cloned() + .unwrap()[selected_word().unwrap()] + .morph + .iter() + .map(|(k, v)| { + view! { +
+ {k} + : + {v} +
+ } }) - .map(|v| v.lemma) - } - /> + .collect_view() + }} -
- -
- {move || { - conts - .get() - .unwrap()[selected_word().unwrap()] - .morph - .iter() - .map(|(k, v)| { +
+
+ {(0..5) + .map(|level| { view! { -
- {k} - : - {v} -
+ } }) - .collect_view() - }} - -
-
- {(0..5) - .map(|level| { - view! { + .collect_view()} +
+
+ } + .into_view() + } else { + view! {}.into_view() + } + }} + "Loading..."

} + }> + {definition + .get() + .map(|data| { + data.iter() + .map(|d| { + match d { + SakinyjeResult::Ok(s) => { + view! { +
+
+ } + .into_view() + } + SakinyjeResult::Err(v) => { + view! { +
Err: {v}
+
+ } + .into_view() + } + } + }) + .collect_view() + })} + {move || { + selected_word() + .map(|i| { + view! { +
- } - }) - .collect_view()} -
-
- } - .into_view() - } else { - view! {}.into_view() - } - }} - - "Loading..."

} - }> - {definition - .get() - .map(|data| { - data.iter() - .map(|d| { - match d { - SakinyjeResult::Ok(s) => { - view! { -
-
- } - .into_view() - } - SakinyjeResult::Err(v) => { - view! { -
Err: {v}
-
- } - .into_view() - } +
} }) - .collect_view() - })} - {move || { - selected_word() - .map(|i| { - view! { -
- -
- } - }) - }} - - + + } } diff --git a/src-ui/style.css b/src-ui/style.css index cd23fe5..8c5f908 100644 --- a/src-ui/style.css +++ b/src-ui/style.css @@ -13,6 +13,20 @@ hr { width: 93%; } + +/* READER AREA */ +.wordpanel { + height: 100%; + width: 460px; + position: fixed; + z-index: 1; + top: 0; + right: 0; + overflow-x: hidden; + padding: 20px; + background-color: #2a273f; +} + /* # SETTINGS AREA */ .settings label { @@ -157,13 +171,17 @@ select { /* GENERAL STUFF */ -.sentence, .wordinfo, .definition, .export, .grammarinfo { +.sentence, .wordinfo, .definition, .grammarinfo { display: flex; justify-content: center; } +.sentence, .input { + margin-right: 460px; +} + .grammarinfo { - font-size: 18px; + font-size: 12px; font-style: italic; color: #908caa; } @@ -212,13 +230,21 @@ select { border: none; text-align: center; text-decoration: none; - width: 15%; + width: 50%; transition-duration: .2s; padding: 10px; border-radius: 6px; border-width: 0; +} + +.export { + position: absolute; + bottom: 0; + left: 0; + width: 100%; display: flex; justify-content: center; + padding-bottom: 50px; } .exportbutton:hover {