Migrate to Id type
This commit is contained in:
+8
-10
@@ -27,14 +27,12 @@ use std::sync::{Arc, Mutex};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RepetitionsState {
|
||||
selected_set_index: Option<usize>,
|
||||
correct_filters: Vec<bool>,
|
||||
current_sets_cards_cache: HashMap<usize, (Vec<usize>, Vec<usize>)>,
|
||||
word_id_index_map: HashMap<u32, usize>,
|
||||
local_settings: HashMap<u32, DeckLocalSetting>,
|
||||
view_data: Option<SetViewData>,
|
||||
pub state: Arc<Mutex<AppState>>,
|
||||
set_names: Vec<String>
|
||||
state: Arc<Mutex<AppState>>,
|
||||
}
|
||||
|
||||
impl NavigatedPage<RepetitionsMessage> for RepetitionsState {
|
||||
@@ -89,7 +87,9 @@ impl NavigatedPage<RepetitionsMessage> for RepetitionsState {
|
||||
GoToHistory => {}
|
||||
GoToSettings => {}
|
||||
|
||||
CreateSet => {}
|
||||
CreateSet => {
|
||||
|
||||
}
|
||||
DeleteSet => {}
|
||||
SetName(_) => {}
|
||||
SelectSet(_) => {}
|
||||
@@ -209,15 +209,15 @@ impl RepetitionsState {
|
||||
button("Проверить фильтр")
|
||||
.style(jl_button)
|
||||
.on_press(TryFilter),
|
||||
self.count_view(&set),
|
||||
self.count_view(set),
|
||||
]
|
||||
.spacing(QUARTER_SPACING),
|
||||
]
|
||||
.spacing(DEFAULT_SPACING)
|
||||
} else {
|
||||
column![
|
||||
self.filled_set_data_view(&set),
|
||||
self.word_append_panel(&set),
|
||||
self.filled_set_data_view(set),
|
||||
self.word_append_panel(set),
|
||||
radio(
|
||||
"Обычный режим",
|
||||
OrderMode::Default,
|
||||
@@ -430,7 +430,6 @@ impl RepetitionsState {
|
||||
|
||||
impl RepetitionsState {
|
||||
fn append_all_words(&self, set: &DeckSettings) {
|
||||
let index = self.selected_set_index.unwrap();
|
||||
let cache = &self.current_sets_cards_cache[&index];
|
||||
let mut created_set = HashSet::with_capacity(cache.0.len());
|
||||
cache.0.iter().for_each(|c| {
|
||||
@@ -461,13 +460,12 @@ impl RepetitionsState {
|
||||
fn select_set(&mut self, index: usize) {
|
||||
let state = self.state.lock().unwrap();
|
||||
if let Some(set) = state.card_sets.get(index) {
|
||||
self.selected_set_index = Some(index);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fn clear_selection(&mut self) {
|
||||
self.selected_set_index = None;
|
||||
self.view_data = None;
|
||||
}
|
||||
}
|
||||
#[derive(Clone)]
|
||||
|
||||
Reference in New Issue
Block a user