Fix the router and stub out a number of crates to get compiling

This commit is contained in:
Jonathan Kelley committed 2024-01-13 20:51:37 -08:00
1 parent 4c6e515da4
commit fae0b08e61
226 files changed
+1057 -1482

No files matched your search

@@ -26,8 +26,8 @@ enum Event {
const MAX_EVENTS: usize = 8;
fn app(cx: Scope) -> Element {
let events = use_ref(cx, Vec::new);
fn app() -> Element {
let events = use_ref(Vec::new);
let events_lock = events.read();
let first_index = events_lock.len().saturating_sub(MAX_EVENTS);
+2 -2
View File
@@ -4,8 +4,8 @@ fn main() {
dioxus_tui::launch(app);
}
fn app(cx: Scope) -> Element {
let radius = use_state(cx, || 0);
fn app() -> Element {
let radius = use_state(|| 0);
cx.render(rsx! {
div {
+3 -3
View File
@@ -13,8 +13,8 @@ struct ButtonProps {
#[allow(non_snake_case)]
fn Button(cx: Scope<ButtonProps>) -> Element {
let toggle = use_state(cx, || false);
let hovered = use_state(cx, || false);
let toggle = use_state(|| false);
let hovered = use_state(|| false);
let hue = cx.props.color_offset % 255;
let saturation = if *toggle.get() { 50 } else { 25 } + if *hovered.get() { 50 } else { 25 };
@@ -50,7 +50,7 @@ fn Button(cx: Scope<ButtonProps>) -> Element {
})
}
fn app(cx: Scope) -> Element {
fn app() -> Element {
cx.render(rsx! {
div {
display: "flex",
+1 -1
View File
@@ -7,7 +7,7 @@ fn main() {
);
}
fn app(cx: Scope) -> Element {
fn app() -> Element {
let steps = 50;
cx.render(rsx! {
div{
+3 -3
View File
@@ -8,9 +8,9 @@ fn main() {
dioxus_tui::launch(app);
}
fn app(cx: Scope) -> Element {
let hue = use_state(cx, || 0.0);
let brightness = use_state(cx, || 0.0);
fn app() -> Element {
let hue = use_state(|| 0.0);
let brightness = use_state(|| 0.0);
let tui_query: Query = cx.consume_context().unwrap();
let mapping: DioxusElementToNodeId = cx.consume_context().unwrap();
// disable templates so that every node has an id and can be queried
+1 -1
View File
@@ -4,7 +4,7 @@ fn main() {
dioxus_tui::launch(app);
}
fn app(cx: Scope) -> Element {
fn app() -> Element {
cx.render(rsx! {
div {
width: "100%",
+9 -9
View File
@@ -8,7 +8,7 @@ fn main() {
dioxus_tui::launch(app);
}
fn app(cx: Scope) -> Element {
fn app() -> Element {
fn to_str(c: &[i32; 3]) -> String {
let mut result = String::new();
result += "#";
@@ -23,20 +23,20 @@ fn app(cx: Scope) -> Element {
127 * b
}
let q1_color = use_state(cx, || [200; 3]);
let q2_color = use_state(cx, || [200; 3]);
let q3_color = use_state(cx, || [200; 3]);
let q4_color = use_state(cx, || [200; 3]);
let q1_color = use_state(|| [200; 3]);
let q2_color = use_state(|| [200; 3]);
let q3_color = use_state(|| [200; 3]);
let q4_color = use_state(|| [200; 3]);
let q1_color_str = to_str(q1_color);
let q2_color_str = to_str(q2_color);
let q3_color_str = to_str(q3_color);
let q4_color_str = to_str(q4_color);
let page_coordinates = use_state(cx, || "".to_string());
let element_coordinates = use_state(cx, || "".to_string());
let buttons = use_state(cx, || "".to_string());
let modifiers = use_state(cx, || "".to_string());
let page_coordinates = use_state(|| "".to_string());
let element_coordinates = use_state(|| "".to_string());
let buttons = use_state(|| "".to_string());
let modifiers = use_state(|| "".to_string());
let update_data = move |event: Event<MouseData>| {
let mouse_data = event.inner();
+1 -1
View File
@@ -4,7 +4,7 @@ fn main() {
dioxus_tui::launch(app);
}
fn app(cx: Scope) -> Element {
fn app() -> Element {
cx.render(rsx! {
div {
width: "100%",
@@ -19,7 +19,7 @@ struct BoxProps {
}
#[allow(non_snake_case)]
fn Box(cx: Scope<BoxProps>) -> Element {
let count = use_state(cx, || 0);
let count = use_state(|| 0);
let x = cx.props.x * 2;
let y = cx.props.y * 2;
@@ -48,8 +48,8 @@ struct GridProps {
#[allow(non_snake_case)]
fn Grid(cx: Scope<GridProps>) -> Element {
let size = cx.props.size;
let count = use_state(cx, || 0);
let counts = use_ref(cx, || vec![0; size * size]);
let count = use_state(|| 0);
let counts = use_ref(|| vec![0; size * size]);
let ctx: TuiContext = cx.consume_context().unwrap();
if *count.get() + 1 >= (size * size) {
+1 -1
View File
@@ -4,7 +4,7 @@ fn main() {
dioxus_tui::launch(app);
}
fn app(cx: Scope) -> Element {
fn app() -> Element {
cx.render(rsx! {
div {
width: "100%",
+1 -1
View File
@@ -28,7 +28,7 @@ fn Quadrant(cx: Scope<QuadrentProps>) -> Element {
})
}
fn app(cx: Scope) -> Element {
fn app() -> Element {
cx.render(rsx! {
div {
width: "100%",
@@ -4,7 +4,7 @@ fn main() {
dioxus_tui::launch(app);
}
fn app(cx: Scope) -> Element {
fn app() -> Element {
cx.render(rsx! {
div {
width: "100%",
+3 -3
View File
@@ -4,10 +4,10 @@ fn main() {
dioxus_tui::launch(app);
}
fn app(cx: Scope) -> Element {
let count = use_state(cx, || 0);
fn app() -> Element {
let count = use_state(|| 0);
use_future(cx, (), move |_| {
use_future((), move |_| {
let count = count.to_owned();
let update = cx.schedule_update();
async move {
+2 -2
View File
@@ -4,8 +4,8 @@ fn main() {
dioxus_tui::launch(app);
}
fn app(cx: Scope) -> Element {
let alpha = use_state(cx, || 100);
fn app() -> Element {
let alpha = use_state(|| 100);
cx.render(rsx! {
div {
+2 -2
View File
@@ -5,8 +5,8 @@ fn main() {
dioxus_tui::launch_cfg(app, Config::new());
}
fn app(cx: Scope) -> Element {
let bg_green = use_state(cx, || false);
fn app() -> Element {
let bg_green = use_state(|| false);
let color = if *bg_green.get() { "green" } else { "red" };
cx.render(rsx! {