diff --git a/src/app.rs b/src/app.rs index 79144711..2b3ea470 100644 --- a/src/app.rs +++ b/src/app.rs @@ -473,6 +473,7 @@ impl Application for XMODITS { } View::Filters => column![ self.custom_filters.view_file_size().map(Message::CustomFilter), + self.custom_filters.view_file_date().map(Message::CustomFilter), self.custom_filters.view_file_name().map(Message::CustomFilter), bottom_left_buttons, ] diff --git a/src/screen/config/custom_filters.rs b/src/screen/config/custom_filters.rs index 69eeb286..6c556a96 100644 --- a/src/screen/config/custom_filters.rs +++ b/src/screen/config/custom_filters.rs @@ -2,6 +2,7 @@ mod file_name; mod file_size; +mod file_date; mod regex; use data::config::filters::{Filter, Name, Size}; @@ -35,6 +36,7 @@ impl Filters { pub enum Message { FileSize(file_size::Message), FileName(file_name::Message), + FileDate(file_date::Message), } #[derive(Default, Debug)] @@ -48,6 +50,7 @@ impl CustomFilters { match msg { Message::FileSize(filesize) => file_size::update(&mut self.filesize, filesize), Message::FileName(filename) => file_name::update(&mut self.filename, filename), + Message::FileDate(filedate) => file_date::update(filedate), } } pub fn view_file_size(&self) -> Element { @@ -57,5 +60,9 @@ impl CustomFilters { pub fn view_file_name(&self) -> Element { file_name::view(&self.filename).map(Message::FileName) } + + pub fn view_file_date(&self) -> Element { + file_date::view().map(Message::FileDate) + } } diff --git a/src/screen/config/custom_filters/file_date.rs b/src/screen/config/custom_filters/file_date.rs new file mode 100644 index 00000000..8b563b0f --- /dev/null +++ b/src/screen/config/custom_filters/file_date.rs @@ -0,0 +1,42 @@ +use std::fmt::Display; + +use crate::theme::TextInputStyle; +use crate::widget::helpers::control; +use crate::widget::Element; +use data::config::filters::{size::Modifier, Size}; +use iced::widget::{button, checkbox, column, horizontal_rule, pick_list, row, slider, text, text_input}; + +#[derive(Debug, Clone, Copy)] +pub enum Message { + DatePicker, +} + +pub fn update(msg: Message) {} + +pub fn view<'a>() -> Element<'a, Message> { + // IDEA: buttons could have a tooltip showing the date&time in more detail + // TODO: buttons must bring up date and time picker, should be an overlay + control( + "File Date", + column![ + pick_list(["Created", "Modified"].as_slice(), Some("Created"), |_| { + Message::DatePicker + }), + horizontal_rule(1), + row![ + row!["From:", button("2005-12-12").on_press(Message::DatePicker)] + .align_items(iced::Alignment::Center) + .spacing(4), + row!["To:", button("2009-12-12").on_press(Message::DatePicker)] + .align_items(iced::Alignment::Center) + .spacing(4) + ] + .align_items(iced::Alignment::Center) + + .spacing(4), + + ] + .spacing(4), + ) + .into() +}