feat: add an artificial task to empty the inbox
All checks were successful
conventional commit messages check / conventional commit messages check (pull_request) Successful in 19s
actionlint check / actionlint check (pull_request) Successful in 25s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 6s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 21s
GitLeaks check / GitLeaks check (pull_request) Successful in 20s
hadolint check / hadolint check (pull_request) Successful in 19s
htmlhint check / htmlhint check (pull_request) Successful in 57s
checkov check / checkov check (pull_request) Successful in 1m51s
markdownlint check / markdownlint check (pull_request) Successful in 47s
ShellCheck check / ShellCheck check (pull_request) Successful in 42s
Prettier check / Prettier check (pull_request) Successful in 1m0s
yamllint check / yamllint check (pull_request) Successful in 45s
Stylelint check / Stylelint check (pull_request) Successful in 59s
Rust check / Rust check (pull_request) Successful in 28m51s
All checks were successful
conventional commit messages check / conventional commit messages check (pull_request) Successful in 19s
actionlint check / actionlint check (pull_request) Successful in 25s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 6s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 21s
GitLeaks check / GitLeaks check (pull_request) Successful in 20s
hadolint check / hadolint check (pull_request) Successful in 19s
htmlhint check / htmlhint check (pull_request) Successful in 57s
checkov check / checkov check (pull_request) Successful in 1m51s
markdownlint check / markdownlint check (pull_request) Successful in 47s
ShellCheck check / ShellCheck check (pull_request) Successful in 42s
Prettier check / Prettier check (pull_request) Successful in 1m0s
yamllint check / yamllint check (pull_request) Successful in 45s
Stylelint check / Stylelint check (pull_request) Successful in 59s
Rust check / Rust check (pull_request) Successful in 28m51s
This commit is contained in:
@@ -2,8 +2,9 @@ use crate::components::task_list::TaskList;
|
|||||||
use crate::hooks::use_tasks_with_subtasks_in_category;
|
use crate::hooks::use_tasks_with_subtasks_in_category;
|
||||||
use crate::internationalization::LocaleFromLanguageIdentifier;
|
use crate::internationalization::LocaleFromLanguageIdentifier;
|
||||||
use crate::models::category::Category;
|
use crate::models::category::Category;
|
||||||
use crate::models::task::TaskWithSubtasks;
|
use crate::models::task::{Task, TaskWithSubtasks};
|
||||||
use chrono::Local;
|
use crate::route::Route;
|
||||||
|
use chrono::{Local, NaiveDateTime};
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
use dioxus_free_icons::Icon;
|
use dioxus_free_icons::Icon;
|
||||||
use dioxus_free_icons::icons::fa_solid_icons::{FaCalendarCheck, FaCalendarXmark, FaWater};
|
use dioxus_free_icons::icons::fa_solid_icons::{FaCalendarCheck, FaCalendarXmark, FaWater};
|
||||||
@@ -42,6 +43,7 @@ pub(crate) fn CategoryTodayTaskList() -> Element {
|
|||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<TaskWithSubtasks>>();
|
.collect::<Vec<TaskWithSubtasks>>();
|
||||||
let long_term_tasks = use_tasks_with_subtasks_in_category(Category::LongTerm)?;
|
let long_term_tasks = use_tasks_with_subtasks_in_category(Category::LongTerm)?;
|
||||||
|
let inbox_tasks = use_tasks_with_subtasks_in_category(Category::Inbox)?;
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div {
|
||||||
@@ -116,8 +118,32 @@ pub(crate) fn CategoryTodayTaskList() -> Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TaskList {
|
div {
|
||||||
tasks: today_tasks
|
TaskList {
|
||||||
|
tasks: today_tasks
|
||||||
|
}
|
||||||
|
if !inbox_tasks.is_empty() {
|
||||||
|
Link {
|
||||||
|
to: Route::CategoryInboxPage {},
|
||||||
|
TaskList {
|
||||||
|
is_interactive: false,
|
||||||
|
tasks: vec![
|
||||||
|
TaskWithSubtasks {
|
||||||
|
task: Task {
|
||||||
|
id: 0,
|
||||||
|
title: t!("empty-inbox")._upper_first(),
|
||||||
|
deadline: None,
|
||||||
|
category: Category::Inbox,
|
||||||
|
project_id: None,
|
||||||
|
created_at: NaiveDateTime::default(),
|
||||||
|
updated_at: NaiveDateTime::default()
|
||||||
|
},
|
||||||
|
subtasks: Vec::new()
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,12 @@ use dioxus::dioxus_core::Element;
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>) -> Element {
|
pub(crate) fn TaskList(
|
||||||
|
tasks: Vec<TaskWithSubtasks>,
|
||||||
|
/// Whether to open and complete tasks on clicks.
|
||||||
|
is_interactive: Option<bool>,
|
||||||
|
class: Option<&'static str>,
|
||||||
|
) -> Element {
|
||||||
let navigator = use_navigator();
|
let navigator = use_navigator();
|
||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div {
|
||||||
@@ -34,6 +39,9 @@ pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>
|
|||||||
onclick: {
|
onclick: {
|
||||||
let task = task.clone();
|
let task = task.clone();
|
||||||
move |_| {
|
move |_| {
|
||||||
|
if let Some(false) = is_interactive {
|
||||||
|
return;
|
||||||
|
}
|
||||||
*TASK_BEING_EDITED.write() = Some(task.task.clone());
|
*TASK_BEING_EDITED.write() = Some(task.task.clone());
|
||||||
navigator.push(Route::TaskFormPage);
|
navigator.push(Route::TaskFormPage);
|
||||||
}
|
}
|
||||||
@@ -49,6 +57,9 @@ pub(crate) fn TaskList(tasks: Vec<TaskWithSubtasks>, class: Option<&'static str>
|
|||||||
// To prevent editing the task.
|
// To prevent editing the task.
|
||||||
event.stop_propagation();
|
event.stop_propagation();
|
||||||
async move {
|
async move {
|
||||||
|
if let Some(false) = is_interactive {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let _ = complete_task(task.task.id).await;
|
let _ = complete_task(task.task.id).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ yesterday = včera
|
|||||||
today = dnes
|
today = dnes
|
||||||
tomorrow = zítra
|
tomorrow = zítra
|
||||||
overdue = zpožděné
|
overdue = zpožděné
|
||||||
|
empty-inbox = vyprázdnit schránku
|
||||||
|
|
||||||
## Date and time formats
|
## Date and time formats
|
||||||
date-format = %-d. %B
|
date-format = %-d. %B
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ yesterday = yesterday
|
|||||||
today = today
|
today = today
|
||||||
tomorrow = tomorrow
|
tomorrow = tomorrow
|
||||||
overdue = overdue
|
overdue = overdue
|
||||||
|
empty-inbox = empty the inbox
|
||||||
|
|
||||||
## Date and time formats
|
## Date and time formats
|
||||||
date-format = %B %-d
|
date-format = %B %-d
|
||||||
|
|||||||
Reference in New Issue
Block a user