chore: upgrade to Dioxus 0.7
All checks were successful
actionlint check / actionlint check (pull_request) Successful in 5s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 5s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 10s
hadolint check / hadolint check (pull_request) Successful in 16s
GitLeaks check / GitLeaks check (pull_request) Successful in 10s
htmlhint check / htmlhint check (pull_request) Successful in 35s
Prettier check / Prettier check (pull_request) Successful in 26s
markdownlint check / markdownlint check (pull_request) Successful in 31s
checkov check / checkov check (pull_request) Successful in 1m15s
ShellCheck check / ShellCheck check (pull_request) Successful in 30s
Stylelint check / Stylelint check (pull_request) Successful in 29s
yamllint check / yamllint check (pull_request) Successful in 27s
Rust check / Rust check (pull_request) Successful in 11m44s

This commit is contained in:
2025-12-17 19:47:28 +01:00
parent 16db7ac2b9
commit 2f933d5302
109 changed files with 3465 additions and 11983 deletions

View File

@@ -1,33 +1,27 @@
use crate::models::project::{NewProject, Project};
use crate::query::{QueryErrors, QueryKey, QueryValue};
use crate::models::project::Project;
use crate::server::projects::{create_project, delete_project, edit_project};
use dioxus::core_macro::{component, rsx};
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
use dioxus_query::prelude::use_query_client;
#[component]
pub(crate) fn ProjectForm(
project: Option<Project>,
on_successful_submit: EventHandler<()>,
) -> Element {
let query_client = use_query_client::<QueryValue, QueryErrors, QueryKey>();
let project_for_submit = project.clone();
rsx! {
form {
onsubmit: move |event| {
event.prevent_default();
let project = project_for_submit.clone();
async move {
let new_project = NewProject::new(
event.values().get("title").unwrap().as_value()
);
let new_project = event.parsed_values().unwrap();
if let Some(project) = project {
let _ = edit_project(project.id(), new_project).await;
let _ = edit_project(project.id, new_project).await;
} else {
let _ = create_project(new_project).await;
}
query_client.invalidate_queries(&[QueryKey::Projects]);
on_successful_submit.call(());
}
},
@@ -44,7 +38,7 @@ pub(crate) fn ProjectForm(
input {
name: "title",
required: true,
initial_value: project.as_ref().map(|project| project.title().to_owned()),
initial_value: project.as_ref().map(|project| project.title.to_owned()),
r#type: "text",
class: "py-2 px-3 grow bg-zinc-800/50 rounded-lg",
id: "input_title"
@@ -54,13 +48,12 @@ pub(crate) fn ProjectForm(
class: "flex flex-row justify-between mt-auto",
button {
r#type: "button",
class: "py-2 px-4 bg-zinc-300/50 rounded-lg",
class: "py-2 px-4 bg-zinc-300/50 rounded-lg cursor-pointer",
onclick: move |_| {
let project = project.clone();
async move {
if let Some(project) = project {
let _ = delete_project(project.id()).await;
query_client.invalidate_queries(&[QueryKey::Projects]);
let _ = delete_project(project.id).await;
}
on_successful_submit.call(());
}
@@ -71,7 +64,7 @@ pub(crate) fn ProjectForm(
}
button {
r#type: "submit",
class: "py-2 px-4 bg-zinc-300/50 rounded-lg",
class: "py-2 px-4 bg-zinc-300/50 rounded-lg cursor-pointer",
i {
class: "fa-solid fa-floppy-disk"
}