Use is_valid for Id
This commit is contained in:
+4
-4
@@ -2,13 +2,14 @@ use crate::data_provider::words::{delete_group, delete_word, update_group, updat
|
||||
use crate::dictionary::DictionaryMessage::*;
|
||||
use crate::dictionary_test::DictionaryQuizState;
|
||||
use crate::import::ImportState;
|
||||
use crate::lang::{WordData, WordGroup, INVALID_ID};
|
||||
use crate::lang::{INVALID_ID, WordData, WordGroup};
|
||||
use crate::navigation::Page::{Import, Word};
|
||||
use crate::navigation::{NavigatedPage, Page};
|
||||
use crate::styling::*;
|
||||
use crate::word::WordState;
|
||||
use crate::{AppState, RootMessage};
|
||||
use chrono::{DateTime, TimeDelta, Utc};
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use iced::alignment::Vertical::Center;
|
||||
use iced::widget::button::Style;
|
||||
use iced::widget::button::{danger, text};
|
||||
@@ -18,7 +19,6 @@ use iced::widget::*;
|
||||
use iced::{Border, Color, Shadow, Task};
|
||||
use iced_core::Length::Fill;
|
||||
use rand::random_range;
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use std::fs;
|
||||
use std::ops::Add;
|
||||
use std::path::PathBuf;
|
||||
@@ -96,7 +96,7 @@ impl NavigatedPage<DictionaryMessage> for DictionaryState {
|
||||
let dict = &state.dictionary;
|
||||
word = dict[*index].clone();
|
||||
}
|
||||
if word.id != INVALID_ID {
|
||||
if word.id.is_valid() {
|
||||
return Some(Word(WordState::new(word, *index, self.state.clone())));
|
||||
}
|
||||
}
|
||||
@@ -423,7 +423,7 @@ impl DictionaryState {
|
||||
let line_button = || {
|
||||
let action = WordAction(index);
|
||||
|
||||
if data.id == INVALID_ID {
|
||||
if !data.id.is_valid() {
|
||||
return button("-").on_press(action).style(|_x, _status| Style {
|
||||
background: None,
|
||||
text_color: Color::BLACK,
|
||||
|
||||
Reference in New Issue
Block a user