every.channel: sanitized baseline
This commit is contained in:
commit
897e556bea
258 changed files with 74298 additions and 0 deletions
125
apps/web/src/main.rs
Normal file
125
apps/web/src/main.rs
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
use dioxus::prelude::*;
|
||||
use wasm_bindgen_futures::JsFuture;
|
||||
|
||||
fn main() {
|
||||
dioxus::launch(App);
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn App() -> Element {
|
||||
let mut link = use_signal(|| "".to_string());
|
||||
let mut status = use_signal(|| "".to_string());
|
||||
|
||||
rsx! {
|
||||
div { class: "page",
|
||||
header { class: "top",
|
||||
div { class: "brand",
|
||||
div { class: "brand-title", "every.channel" }
|
||||
div { class: "brand-subtitle",
|
||||
"Watch and share free over-the-air TV. Local first, global when you want."
|
||||
}
|
||||
}
|
||||
nav { class: "nav",
|
||||
a { href: "#watch", "Watch" }
|
||||
a { href: "#directory", "Directory" }
|
||||
a { href: "#join", "Join" }
|
||||
a { href: "#about", "Info" }
|
||||
}
|
||||
}
|
||||
|
||||
div { class: "grid",
|
||||
section { class: "card section", id: "watch",
|
||||
div { class: "card-title", "Watch" }
|
||||
div { class: "h1", "Watch a link" }
|
||||
div { class: "p",
|
||||
"Got a link from a friend? Paste it here to copy, then open the desktop app."
|
||||
}
|
||||
div { class: "row",
|
||||
input {
|
||||
class: "input",
|
||||
placeholder: "every.channel://watch?...",
|
||||
value: "{link.read()}",
|
||||
oninput: move |evt| link.set(evt.value()),
|
||||
}
|
||||
button {
|
||||
class: "btn primary",
|
||||
onclick: move |_| {
|
||||
let value = link.read().trim().to_string();
|
||||
if value.is_empty() {
|
||||
status.set("Paste a link first".to_string());
|
||||
return;
|
||||
}
|
||||
let mut status = status.clone();
|
||||
spawn(async move {
|
||||
match copy_to_clipboard(value).await {
|
||||
Ok(_) => status.set("Copied! Open the app and paste under Watch a Link.".to_string()),
|
||||
Err(err) => status.set(format!("Copy failed: {err}")),
|
||||
}
|
||||
});
|
||||
},
|
||||
"Copy"
|
||||
}
|
||||
}
|
||||
if !status.read().is_empty() {
|
||||
div { class: "kicker",
|
||||
span { class: "dot" }
|
||||
span { "{status.read()}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
section { class: "card section", id: "directory",
|
||||
div { class: "card-title", "Directory" }
|
||||
div { class: "h1", "Find channels from people you trust" }
|
||||
div { class: "p",
|
||||
"The directory is opt-in. You choose what to share and who to connect with."
|
||||
}
|
||||
div { class: "kicker",
|
||||
span { class: "dot" }
|
||||
span { "Enable Nearby or Public reach in the app to find others." }
|
||||
}
|
||||
}
|
||||
|
||||
section { class: "card section", id: "join",
|
||||
div { class: "card-title", "Join" }
|
||||
div { class: "h1", "Run your own" }
|
||||
div { class: "p",
|
||||
"Anyone can watch, share, and relay. Works with HDHomeRun, Linux TV tuners, and live streams."
|
||||
}
|
||||
div { class: "kicker",
|
||||
span { class: "dot" }
|
||||
span { "Desktop app and CLI available now." }
|
||||
}
|
||||
}
|
||||
|
||||
section { class: "card section", id: "about",
|
||||
div { class: "card-title", "About" }
|
||||
div { class: "h1", "A small promise" }
|
||||
div { class: "p",
|
||||
"TV signals are just waves in the air. This project makes it easier to pick them up and share them with others."
|
||||
}
|
||||
div { class: "kicker",
|
||||
span { class: "dot" }
|
||||
span { "Open source. No central server." }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
footer { class: "footer",
|
||||
span { "AGPLv3" }
|
||||
span { "every.channel" }
|
||||
a { href: "https://every.channel", "every.channel" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn copy_to_clipboard(text: String) -> Result<(), String> {
|
||||
let window = web_sys::window().ok_or_else(|| "window unavailable".to_string())?;
|
||||
let clipboard = window.navigator().clipboard();
|
||||
let promise = clipboard.write_text(&text);
|
||||
JsFuture::from(promise)
|
||||
.await
|
||||
.map_err(|err| format!("clipboard write rejected: {err:?}"))?;
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue