Compare commits
1 Commits
b5e7ab5c48
...
a6711b3e47
| Author | SHA1 | Date | |
|---|---|---|---|
|
a6711b3e47
|
@@ -32,7 +32,6 @@ pub(crate) fn Input(
|
|||||||
name: name.clone(),
|
name: name.clone(),
|
||||||
r#type,
|
r#type,
|
||||||
id: id.unwrap_or(format!("input_{}", name)),
|
id: id.unwrap_or(format!("input_{}", name)),
|
||||||
autofocus,
|
|
||||||
oninput: move |event| {
|
oninput: move |event| {
|
||||||
if let Some(oninput) = oninput {
|
if let Some(oninput) = oninput {
|
||||||
oninput.call(event);
|
oninput.call(event);
|
||||||
@@ -43,6 +42,11 @@ pub(crate) fn Input(
|
|||||||
onchange.call(event);
|
onchange.call(event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onmounted: move |element| async move {
|
||||||
|
if let Some(true) = autofocus {
|
||||||
|
let _ = element.set_focus(true).await;
|
||||||
|
}
|
||||||
|
},
|
||||||
..attributes
|
..attributes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,6 @@ pub(crate) fn ProjectForm() -> Element {
|
|||||||
if let Some(project) = project {
|
if let Some(project) = project {
|
||||||
let result = delete_project(project.id).await;
|
let result = delete_project(project.id).await;
|
||||||
if result.is_ok() {
|
if result.is_ok() {
|
||||||
/* TODO: Might not work on mobile due to
|
|
||||||
https://dioxuslabs.com/learn/0.7/essentials/router/navigation#history-buttons.
|
|
||||||
*/
|
|
||||||
navigator.go_back();
|
navigator.go_back();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ pub(crate) fn ProjectSelect(initial_selected_id: Option<i32>) -> Element {
|
|||||||
rsx! {
|
rsx! {
|
||||||
select {
|
select {
|
||||||
name: "project_id",
|
name: "project_id",
|
||||||
class: "px-4 pt-3 pb-2.25 bg-gray-800-muted enabled:hover:bg-gray-800 enabled:active:bg-gray-800 drop-shadow-[0_calc(0px_-_var(--spacing))_0_var(--color-gray-900-muted)] rounded-xl grow cursor-pointer",
|
class: "px-4 pt-3 pb-2.25 bg-gray-800-muted enabled:hover:bg-gray-800 enabled:active:bg-gray-800 drop-shadow-[0_calc(0px_-_var(--spacing))_0_var(--color-gray-900-muted)] rounded-xl grow cursor-pointer transition-all duration-150",
|
||||||
id: "input_project_id",
|
id: "input_project_id",
|
||||||
option {
|
option {
|
||||||
value: 0,
|
value: 0,
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ pub(crate) fn ReoccurrenceIntervalInput(
|
|||||||
class_buttons: Option<&'static str>,
|
class_buttons: Option<&'static str>,
|
||||||
) -> Element {
|
) -> Element {
|
||||||
rsx! {
|
rsx! {
|
||||||
// TODO: Abstract into SelectButton. Make it sank into the surface by default, like other inputs (abstract those too haha), and rise it up on selection (rationale: it will influence what is on the surface).
|
|
||||||
SelectButton {
|
SelectButton {
|
||||||
icon: FaBan,
|
icon: FaBan,
|
||||||
is_selected: reoccurrence_interval().is_none(),
|
is_selected: reoccurrence_interval().is_none(),
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ pub(crate) fn TaskForm() -> Element {
|
|||||||
required: true,
|
required: true,
|
||||||
initial_value: task.as_ref().map(|task| task.title.clone()),
|
initial_value: task.as_ref().map(|task| task.title.clone()),
|
||||||
r#type: "text",
|
r#type: "text",
|
||||||
autofocus: true
|
autofocus: task.is_none()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
div {
|
div {
|
||||||
@@ -246,16 +246,16 @@ pub(crate) fn TaskForm() -> Element {
|
|||||||
r#for: "input_category_calendar_date"
|
r#for: "input_category_calendar_date"
|
||||||
},
|
},
|
||||||
div {
|
div {
|
||||||
class: "grow grid grid-cols-2 gap-3",
|
class: "grow grid grid-cols-7 gap-3",
|
||||||
Input {
|
Input {
|
||||||
class: "grow",
|
class: "grow col-span-4",
|
||||||
name: "category_calendar_date",
|
name: "category_calendar_date",
|
||||||
r#type: "date",
|
r#type: "date",
|
||||||
required: true,
|
required: true,
|
||||||
initial_value: date.format("%Y-%m-%d").to_string(),
|
initial_value: date.format("%Y-%m-%d").to_string(),
|
||||||
},
|
},
|
||||||
Input {
|
Input {
|
||||||
class: "grow",
|
class: "grow col-span-3",
|
||||||
name: "category_calendar_time",
|
name: "category_calendar_time",
|
||||||
r#type: "time",
|
r#type: "time",
|
||||||
initial_value: time.map(|calendar_time|
|
initial_value: time.map(|calendar_time|
|
||||||
@@ -367,9 +367,6 @@ pub(crate) fn TaskForm() -> Element {
|
|||||||
edit_task(task.id, new_task).await.map(|_| ())
|
edit_task(task.id, new_task).await.map(|_| ())
|
||||||
};
|
};
|
||||||
if result.is_ok() {
|
if result.is_ok() {
|
||||||
/* TODO: Might not work on mobile due to
|
|
||||||
https://dioxuslabs.com/learn/0.7/essentials/router/navigation#history-buttons.
|
|
||||||
*/
|
|
||||||
navigator.go_back();
|
navigator.go_back();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user