Skip to content

Commit

Permalink
fix: Deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kdheepak committed May 13, 2024
1 parent 10b3ef7 commit aeefdea
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use crate::{
Pane,
},
scrollbar::Scrollbar,
table::{Row, Table, TableMode, TableState},
table::{Row, Table, TableMode, TaskwarriorTuiTableState},
task_report::TaskReportTable,
ui, utils,
};
Expand Down Expand Up @@ -167,7 +167,7 @@ pub enum Mode {
pub struct TaskwarriorTui {
pub should_quit: bool,
pub dirty: bool,
pub task_table_state: TableState,
pub task_table_state: TaskwarriorTuiTableState,
pub current_context_filter: String,
pub current_context: String,
pub command: LineBuffer,
Expand Down Expand Up @@ -254,7 +254,7 @@ impl TaskwarriorTui {
let mut app = Self {
should_quit: false,
dirty: true,
task_table_state: TableState::default(),
task_table_state: TaskwarriorTuiTableState::default(),
tasks: vec![],
all_tasks: vec![],
task_details: HashMap::new(),
Expand Down
6 changes: 3 additions & 3 deletions src/pane/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use crate::{
app::{Mode, TaskwarriorTui},
event::KeyCode,
pane::Pane,
table::TableState,
table::TaskwarriorTuiTableState,
};

#[derive(Debug, Clone, Default)]
Expand All @@ -55,7 +55,7 @@ impl ContextDetails {
}

pub struct ContextsState {
pub table_state: TableState,
pub table_state: TaskwarriorTuiTableState,
pub report_height: u16,
pub columns: Vec<String>,
pub rows: Vec<ContextDetails>,
Expand All @@ -64,7 +64,7 @@ pub struct ContextsState {
impl ContextsState {
pub(crate) fn new() -> Self {
Self {
table_state: TableState::default(),
table_state: TaskwarriorTuiTableState::default(),
report_height: 0,
columns: vec![NAME.to_string(), TYPE.to_string(), DEFINITION.to_string(), ACTIVE.to_string()],
rows: vec![],
Expand Down
6 changes: 3 additions & 3 deletions src/pane/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ use crate::{
app::{Mode, TaskwarriorTui},
event::KeyCode,
pane::Pane,
table::TableState,
table::TaskwarriorTuiTableState,
utils::Changeset,
};

pub struct ProjectsState {
pub(crate) list: Vec<Project>,
pub table_state: TableState,
pub table_state: TaskwarriorTuiTableState,
pub current_selection: usize,
pub marked: HashSet<Project>,
pub columns: Vec<String>,
Expand All @@ -58,7 +58,7 @@ impl ProjectsState {
pub(crate) fn new() -> Self {
Self {
list: Vec::default(),
table_state: TableState::default(),
table_state: TaskwarriorTuiTableState::default(),
current_selection: 0,
marked: HashSet::default(),
columns: vec![
Expand Down
14 changes: 7 additions & 7 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ pub enum TableMode {
}

#[derive(Clone)]
pub struct TableState {
pub struct TaskwarriorTuiTableState {
offset: usize,
current_selection: Option<usize>,
marked: HashSet<usize>,
mode: TableMode,
}

impl Default for TableState {
fn default() -> TableState {
TableState {
impl Default for TaskwarriorTuiTableState {
fn default() -> TaskwarriorTuiTableState {
TaskwarriorTuiTableState {
offset: 0,
current_selection: Some(0),
marked: HashSet::new(),
Expand All @@ -43,7 +43,7 @@ impl Default for TableState {
}
}

impl TableState {
impl TaskwarriorTuiTableState {
pub fn mode(&self) -> TableMode {
self.mode.clone()
}
Expand Down Expand Up @@ -305,7 +305,7 @@ where
D::Item: Display,
R: Iterator<Item = Row<D>>,
{
type State = TableState;
type State = TaskwarriorTuiTableState;

fn render(mut self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {
buf.set_style(area, self.style);
Expand Down Expand Up @@ -530,7 +530,7 @@ where
R: Iterator<Item = Row<D>>,
{
fn render(self, area: Rect, buf: &mut Buffer) {
let mut state = TableState::default();
let mut state = TaskwarriorTuiTableState::default();
StatefulWidget::render(self, area, buf, &mut state);
}
}
2 changes: 1 addition & 1 deletion src/task_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn format_date_time(dt: NaiveDateTime) -> String {

pub fn format_date(dt: NaiveDateTime) -> String {
let offset = Local.offset_from_utc_datetime(&dt);
let dt = DateTime::<Local>::from_utc(dt, offset);
let dt = DateTime::<Local>::from_naive_utc_and_offset(dt, offset);
dt.format("%Y-%m-%d").to_string()
}

Expand Down

0 comments on commit aeefdea

Please sign in to comment.