style.css and numbered instructions
This commit is contained in:
@@ -17,30 +17,21 @@ fn main() {
|
|||||||
fn App(cx: Scope) -> Element {
|
fn App(cx: Scope) -> Element {
|
||||||
let file = use_state(cx, || String::new());
|
let file = use_state(cx, || String::new());
|
||||||
let status = use_state(cx, || String::new());
|
let status = use_state(cx, || String::new());
|
||||||
|
let processing = use_state(cx, || false);
|
||||||
let analysis = use_state(cx, || Analysis::new());
|
let analysis = use_state(cx, || Analysis::new());
|
||||||
|
let a_css = String::from_utf8_lossy(include_bytes!("./style.css"));
|
||||||
cx.render(rsx! {
|
cx.render(rsx! {
|
||||||
header {
|
header {
|
||||||
style { "
|
style { "{a_css}" }
|
||||||
body {{
|
|
||||||
max-width: 600pt;
|
|
||||||
margin: auto;
|
|
||||||
zoom: 150%;
|
|
||||||
}}
|
|
||||||
label {{
|
|
||||||
display: block;
|
|
||||||
}}
|
|
||||||
label:has(input[type=checkbox]:checked) {{
|
|
||||||
background-color: lightgreen;
|
|
||||||
}}
|
|
||||||
" }
|
|
||||||
}
|
}
|
||||||
main {
|
main {
|
||||||
rsx! {
|
rsx! {
|
||||||
h1 { "home-video-blue-extractinator" }
|
h1 { "home-video-blue-extractinator" }
|
||||||
|
h3 { "1. Choose your movie" }
|
||||||
div {
|
div {
|
||||||
input {
|
input {
|
||||||
r#type: "file",
|
r#type: "file",
|
||||||
disabled: status.get().starts_with("[WORKING]"),
|
disabled: *processing.get(),
|
||||||
onchange: |evt| {
|
onchange: |evt| {
|
||||||
to_owned![file];
|
to_owned![file];
|
||||||
if let Some(file_engine) = &evt.files {
|
if let Some(file_engine) = &evt.files {
|
||||||
@@ -52,15 +43,18 @@ fn App(cx: Scope) -> Element {
|
|||||||
},
|
},
|
||||||
p { file.get().clone() }
|
p { file.get().clone() }
|
||||||
}
|
}
|
||||||
|
h3 { "2. Analyze your movie" }
|
||||||
div {
|
div {
|
||||||
input { r#type: "button", value: "analyze", disabled: file.get().len() == 0 || status.get().starts_with("[WORKING]"), onclick: move |_| {
|
input { r#type: "button", value: "analyze", disabled: file.get().len() == 0 || *processing.get(), onclick: move |_| {
|
||||||
cx.spawn({
|
cx.spawn({
|
||||||
let file = file.to_owned();
|
let file = file.to_owned();
|
||||||
let status = status.to_owned();
|
let status = status.to_owned();
|
||||||
|
let processing = processing.to_owned();
|
||||||
let analysis = analysis.to_owned();
|
let analysis = analysis.to_owned();
|
||||||
|
|
||||||
async move {
|
async move {
|
||||||
status.set(format!("[WORKING] analyzing {file}... (this may take a while, like 5 minutes, but I promise I'm working on it)"));
|
processing.set(true);
|
||||||
|
status.set(format!("analyzing {file}... (this may take a while, like 5 minutes, but I promise I'm working on it)"));
|
||||||
let analyzed = analyze(file.get().clone()).await;
|
let analyzed = analyze(file.get().clone()).await;
|
||||||
if analyzed.err.len() > 0 {
|
if analyzed.err.len() > 0 {
|
||||||
status.set(analyzed.err.clone());
|
status.set(analyzed.err.clone());
|
||||||
@@ -72,6 +66,7 @@ fn App(cx: Scope) -> Element {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
analysis.set(analyzed);
|
analysis.set(analyzed);
|
||||||
|
processing.set(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
@@ -82,7 +77,6 @@ fn App(cx: Scope) -> Element {
|
|||||||
br {}
|
br {}
|
||||||
}
|
}
|
||||||
div {
|
div {
|
||||||
h3 { "Content Spans" }
|
|
||||||
form {
|
form {
|
||||||
onsubmit: |evt| {
|
onsubmit: |evt| {
|
||||||
let content_spans: Vec<_> = evt.values.iter()
|
let content_spans: Vec<_> = evt.values.iter()
|
||||||
@@ -96,16 +90,19 @@ fn App(cx: Scope) -> Element {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
status.set(format!("[WORKING] clipifying {:?}...", content_spans));
|
status.set(format!("clipifying {:?}...", content_spans));
|
||||||
let file = file.get().clone();
|
let file = file.get().clone();
|
||||||
to_owned![status];
|
to_owned![status];
|
||||||
|
to_owned![processing];
|
||||||
async move {
|
async move {
|
||||||
|
processing.set(true);
|
||||||
let f = clipify(file, content_spans).await;
|
let f = clipify(file, content_spans).await;
|
||||||
status.set(f);
|
status.set(f);
|
||||||
|
processing.set(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
input { r#type: "submit", value: "clipify selected spans", disabled: file.get().len() == 0 || status.get().starts_with("[WORKING]") || analysis.get().result.len() == 0 }
|
|
||||||
hr {}
|
hr {}
|
||||||
|
h3 { "3. Double check the scenes to keep (green) are okay" }
|
||||||
analysis.get().result.iter().map(|a| {
|
analysis.get().result.iter().map(|a| {
|
||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div {
|
||||||
@@ -122,6 +119,9 @@ fn App(cx: Scope) -> Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
hr {}
|
||||||
|
h3 { "4. Submit your re-clip" }
|
||||||
|
input { r#type: "submit", value: "clipify selected spans", disabled: file.get().len() == 0 || *processing.get() || analysis.get().result.len() == 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,4 +227,4 @@ async fn clipify(file: String, content_spans: Vec<lib::video::ContentSpan>) -> S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const a_png: &str = "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
const a_png: &str = r"iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
|
||||||
|
|||||||
13
src/src/style.css
Normal file
13
src/src/style.css
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user