Functional parity with linux
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
use ruin_app::prelude::*;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
#[ruin_runtime::async_main]
|
||||
async fn main() -> ruin_app::Result<()> {
|
||||
let _ = tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
|
||||
)
|
||||
.with_target(true)
|
||||
.without_time()
|
||||
.try_init();
|
||||
|
||||
let title = "RUIN Counter";
|
||||
|
||||
App::new()
|
||||
|
||||
@@ -90,21 +90,12 @@ fn TaskBoard() -> impl IntoView {
|
||||
}
|
||||
});
|
||||
|
||||
let all_label = if matches!(filter.get(), TaskFilter::All) {
|
||||
"● All"
|
||||
} else {
|
||||
"○ All"
|
||||
};
|
||||
let open_label = if matches!(filter.get(), TaskFilter::OpenOnly) {
|
||||
"● Open"
|
||||
} else {
|
||||
"○ Open"
|
||||
};
|
||||
let done_label = if matches!(filter.get(), TaskFilter::CompletedOnly) {
|
||||
"● Completed"
|
||||
} else {
|
||||
"○ Completed"
|
||||
};
|
||||
let all_label = filter_label(matches!(filter.get(), TaskFilter::All), "All");
|
||||
let open_label = filter_label(matches!(filter.get(), TaskFilter::OpenOnly), "Open");
|
||||
let done_label = filter_label(
|
||||
matches!(filter.get(), TaskFilter::CompletedOnly),
|
||||
"Completed",
|
||||
);
|
||||
let task_rows = visible_ids.with(|ids| {
|
||||
ids.iter()
|
||||
.map(|task_id| {
|
||||
@@ -466,6 +457,14 @@ fn move_task(tasks: &Signal<Vec<Task>>, task_id: u64, direction: MoveDirection)
|
||||
});
|
||||
}
|
||||
|
||||
fn filter_label(active: bool, label: &str) -> String {
|
||||
if active {
|
||||
format!("[x] {label}")
|
||||
} else {
|
||||
format!("[ ] {label}")
|
||||
}
|
||||
}
|
||||
|
||||
fn seed_tasks() -> Vec<Task> {
|
||||
vec![
|
||||
Task {
|
||||
|
||||
@@ -268,6 +268,7 @@ fn RuntimeIoExample(server_addr: SocketAddr) -> impl IntoView {
|
||||
};
|
||||
eprintln!("example05: {message}");
|
||||
let _ = save_status.set(Some(message));
|
||||
flush_reactive_updates();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user