Files
todo-baggins/src/components/project_select.rs
Matouš Volf c48c71b56b
Some checks failed
actionlint check / actionlint check (pull_request) Successful in 7s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 4s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 7s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 8s
GitLeaks check / GitLeaks check (pull_request) Successful in 11s
hadolint check / hadolint check (pull_request) Successful in 15s
markdownlint check / markdownlint check (pull_request) Successful in 30s
htmlhint check / htmlhint check (pull_request) Successful in 35s
Prettier check / Prettier check (pull_request) Successful in 26s
checkov check / checkov check (pull_request) Successful in 1m11s
ShellCheck check / ShellCheck check (pull_request) Successful in 24s
Stylelint check / Stylelint check (pull_request) Successful in 25s
yamllint check / yamllint check (pull_request) Successful in 1m30s
Rust check / Rust check (pull_request) Failing after 2m33s
chore: upgrade to Dioxus 0.7
2025-12-18 19:58:59 +01:00

31 lines
885 B
Rust

use crate::hooks::use_projects;
use dioxus::core_macro::{component, rsx};
use dioxus::dioxus_core::Element;
use dioxus::prelude::*;
use dioxus_i18n::t;
#[component]
pub(crate) fn ProjectSelect(initial_selected_id: Option<i32>) -> Element {
let projects = use_projects()?();
rsx! {
select {
name: "project_id",
class: "px-3.5 py-2.5 bg-zinc-800/50 rounded-lg grow cursor-pointer",
id: "input_project",
option {
value: 0,
{t!("none")}
},
for project in projects {
option {
value: project.id.to_string(),
initial_selected: initial_selected_id.is_some_and(
|id| id == project.id
),
{project.title}
}
}
}
}
}