back_overlay first

This commit is contained in:
2026-08-01 17:23:43 +03:00
parent 4d6de8a02c
commit 9a1d68aac1
2 changed files with 40 additions and 28 deletions
+21 -27
View File
@@ -4,8 +4,12 @@ use crate::dictionary::DictionaryMessage::{
};
use crate::dictionary_test::DictionaryQuizState;
use crate::lang::{WordData, WordGroup};
use crate::navigation::Page::Word;
use crate::navigation::{NavigatedPage, Page};
use crate::styling::*;
use crate::word::WordState;
use crate::{AppState, RootMessage };
use crate::{AppState, RootMessage};
use DictionaryMessage::Back;
use chrono::{DateTime, TimeDelta, Utc};
use iced::alignment::Vertical::Center;
use iced::widget::button::Style;
@@ -20,10 +24,6 @@ use std::ops::Add;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
use DictionaryMessage::Back;
use crate::navigation::{NavigatedPage, Page};
use crate::navigation::Page::Word;
use crate::styling::*;
#[derive(Clone)]
pub struct DictionaryState {
@@ -160,7 +160,6 @@ impl DictionaryState {
v = v[..v.len() - 2].to_string()
}
while v.contains(",,") {
let index = v.find(",,").unwrap();
v.remove(index);
@@ -292,21 +291,17 @@ impl DictionaryState {
}
pub fn view(&self) -> iced::Element<'_, DictionaryMessage> {
container(
row![
iced::widget::column![
button("Назад").style(jl_button).on_press(Back),
self.groups_panel(),
self.words_list(),
button("Добавить слово").style(jl_button).on_press(DictionaryMessage::NewWord),
]
.spacing(5),
self.filters()
back_overlay(
iced::widget::column![
self.groups_panel(),
self.words_list(),
button("Добавить слово")
.style(jl_button)
.on_press(DictionaryMessage::NewWord),
]
.spacing(DEFAULT_SPACING),
.into(),
Back,
)
.padding(10)
.into()
}
fn words_list(&self) -> iced::Element<'_, DictionaryMessage> {
@@ -415,13 +410,14 @@ impl DictionaryState {
toggler(self.reverse)
.label("Обратный тест")
.on_toggle(DictionaryMessage::SetReverse),
button(text!("Тест").center().width(Length::Fill)).style(jl_button)
button(text!("Тест").center().width(Length::Fill))
.style(jl_button)
.on_press(Test)
.width(Length::Fill),
]
.width(250)
.spacing(DEFAULT_SPACING)
.into()
.width(250)
.spacing(DEFAULT_SPACING)
.into()
}
fn tags_selector(&self) -> iced::Element<'_, DictionaryMessage> {
@@ -462,7 +458,6 @@ impl DictionaryState {
});
});
let current_tags = self
.tag_map
.keys()
@@ -544,7 +539,7 @@ impl DictionaryState {
]
.spacing(DEFAULT_SPACING)
]
.into()
.into()
}
}
@@ -555,7 +550,6 @@ pub fn split_with_coma(ts: &str) -> Vec<String> {
.collect::<Vec<String>>()
}
pub fn app_data_dir() -> PathBuf {
let mut dir = dirs::data_dir().unwrap();
dir.push("jap_learn");
@@ -574,4 +568,4 @@ pub fn app_cache_dir() -> PathBuf {
}
dir
}
}