gonna try nfd
parent
2645c63bf5
commit
4f69c24e44
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "src"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dioxus = "0.4.3"
|
||||
dioxus-web = "0.4.3"
|
||||
#dioxus-desktop = "0.4.3"
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
#![allow(non_snake_case)]
|
||||
// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
// launch the dioxus app in a webview
|
||||
// dioxus_desktop::launch(App);
|
||||
dioxus_web::launch(App);
|
||||
}
|
||||
|
||||
// define a component that renders a div with the text "Hello, world!"
|
||||
fn App(cx: Scope) -> Element {
|
||||
let file = use_state(cx, String::new);
|
||||
cx.render(rsx! {
|
||||
header {
|
||||
h1 { "home-video-blue-extractinator" }
|
||||
}
|
||||
main {
|
||||
rsx! {
|
||||
div {
|
||||
input {
|
||||
r#type: "file",
|
||||
onchange: |evt| {
|
||||
to_owned![file];
|
||||
async move {
|
||||
match &evt.files {
|
||||
Some(file_engine) => {
|
||||
match file_engine.files().iter().nth(0) {
|
||||
Some(f) => {
|
||||
file.set("...".to_string());
|
||||
match file_engine.read_file_to_string(f).await {
|
||||
Some(content) => { file.set("ok".to_string()); },
|
||||
None => {},
|
||||
};
|
||||
match file_engine.get_native_file(f).await {
|
||||
Some(f) => { file.set(format!("{:?}", f.type_id())); },
|
||||
None => { file.set("failed to get native file".to_string()); },
|
||||
};
|
||||
},
|
||||
None => {},
|
||||
};
|
||||
}
|
||||
None => {},
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
input { r#type: "button", value: "analyze", onclick: move |evt| { analyze(evt); } }
|
||||
input { r#type: "button", value: "clipify", onclick: move |evt| { clipify(evt); } }
|
||||
}
|
||||
h2 { file.get().clone() }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn analyze(evt: Event<MouseData>) {
|
||||
eprintln!("analyze");
|
||||
}
|
||||
|
||||
fn clipify(evt: Event<MouseData>) {
|
||||
eprintln!("clipify");
|
||||
}
|
||||
Loading…
Reference in New Issue