diff --git a/src/main.rs b/src/main.rs
index 951272b..61f74f9 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -29,7 +29,7 @@ use tower_http::{limit::RequestBodyLimitLayer, services::ServeDir, trace::TraceL
mod cache;
mod logging;
mod nyazoom_headers;
-pub mod ssr;
+mod ssr;
mod state;
mod sweeper;
mod util;
@@ -37,8 +37,8 @@ mod views;
use state::{AppState, UploadRecord};
-use crate::state::AsyncRemoveRecord;
-use crate::views::{DownloadLinkPage, HtmxPage, LinkView, Welcome};
+use crate::state::*;
+use crate::views::*;
#[tokio::main]
async fn main() -> io::Result<()> {
@@ -95,7 +95,7 @@ async fn remaining(
async fn welcome() -> impl IntoResponse {
let cat_fact = views::get_cat_fact().await;
Html(ssr::render(move || {
- leptos::view! { }
+ leptos::view! { }
}))
}
diff --git a/src/views.rs b/src/views.rs
deleted file mode 100644
index ca9dd41..0000000
--- a/src/views.rs
+++ /dev/null
@@ -1,136 +0,0 @@
-use futures::TryFutureExt;
-use leptos::{component, view, Children, IntoView};
-use serde::Deserialize;
-
-use crate::state::UploadRecord;
-
-#[derive(Debug, Deserialize)]
-pub struct CatFact {
- pub fact: String,
-}
-
-pub async fn get_cat_fact() -> String {
- reqwest::get("https://catfact.ninja/fact")
- .and_then(|res| res.json())
- .map_ok(|cf: CatFact| cf.fact)
- .await
- .unwrap_or_else(|_| String::from("The cat fact goddess has failed me :<"))
-}
-
-// {https://api.thecatapi.com/v1/images/search?size=small&format=src}
-// {https://cataas.com/cat?width=250&height=250}
-#[component]
-pub fn Welcome(fact: String) -> impl IntoView {
- view! {
-
-
-
-
-
- }
-}
-
-#[component]
-pub fn WelcomeView(fact: String) -> impl IntoView {
- view! {
-
-
- }
-}
-
-//
-// #TODO: Handle pushing cleaner
-#[component]
-pub fn DownloadLinkPage(id: String, record: UploadRecord) -> impl IntoView {
- view! {
-
-
-
-
-
- }
-}
-
-#[component]
-pub fn HtmxPage(children: Children) -> impl IntoView {
- view! {
-
- Nyazoom
-
-
-
-
-
-
-
-
-
-
- NyaZoom2
- {children()}
-
- }
-}
-
-#[component]
-pub fn LinkView(id: String, record: UploadRecord) -> impl IntoView {
- let downloads_remaining = record.max_downloads - record.downloads;
- let plural = if downloads_remaining > 1 { "s" } else { "" };
- view! {
-
-
-
-
- You have
- {record.downloads_remaining()}
- download
- {plural}
- remaining!
-
-
-
-
- Return to home
-
-
- }
-}
diff --git a/src/views/base_page.rs b/src/views/base_page.rs
new file mode 100644
index 0000000..88f22a1
--- /dev/null
+++ b/src/views/base_page.rs
@@ -0,0 +1,26 @@
+use leptos::{component, view, Children, IntoView};
+
+#[component]
+pub fn HtmxPage(children: Children) -> impl IntoView {
+ view! {
+
+ Nyazoom
+
+
+
+
+
+
+
+
+
+
+ NyaZoom2
+ {children()}
+
+ }
+}
diff --git a/src/views/links.rs b/src/views/links.rs
new file mode 100644
index 0000000..e0a1624
--- /dev/null
+++ b/src/views/links.rs
@@ -0,0 +1,51 @@
+use leptos::{component, view, IntoView};
+
+use crate::state::UploadRecord;
+use crate::HtmxPage;
+
+//
+// #TODO: Handle pushing cleaner
+#[component]
+pub fn DownloadLinkPage(id: String, record: UploadRecord) -> impl IntoView {
+ view! {
+
+
+
+
+
+ }
+}
+
+#[component]
+pub fn LinkView(id: String, record: UploadRecord) -> impl IntoView {
+ let downloads_remaining = record.max_downloads - record.downloads;
+ let plural = if downloads_remaining > 1 { "s" } else { "" };
+ view! {
+
+
+
+
+ You have
+ {record.downloads_remaining()}
+ download
+ {plural}
+ remaining!
+
+
+
+
+ Return to home
+
+
+ }
+}
diff --git a/src/views/mod.rs b/src/views/mod.rs
new file mode 100644
index 0000000..d4c6e42
--- /dev/null
+++ b/src/views/mod.rs
@@ -0,0 +1,23 @@
+use futures::TryFutureExt;
+use serde::Deserialize;
+
+pub mod base_page;
+pub mod links;
+pub mod welcome;
+
+pub use base_page::*;
+pub use links::*;
+pub use welcome::*;
+
+#[derive(Debug, Deserialize)]
+pub struct CatFact {
+ pub fact: String,
+}
+
+pub async fn get_cat_fact() -> String {
+ reqwest::get("https://catfact.ninja/fact")
+ .and_then(|res| res.json())
+ .map_ok(|cf: CatFact| cf.fact)
+ .await
+ .unwrap_or_else(|_| String::from("The cat fact goddess has failed me :<"))
+}
diff --git a/src/views/welcome.rs b/src/views/welcome.rs
new file mode 100644
index 0000000..0231f12
--- /dev/null
+++ b/src/views/welcome.rs
@@ -0,0 +1,49 @@
+use leptos::{component, view, IntoView};
+
+use crate::HtmxPage;
+
+// {https://api.thecatapi.com/v1/images/search?size=small&format=src}
+// {https://cataas.com/cat?width=250&height=250}
+#[component]
+pub fn WelcomePage(fact: String) -> impl IntoView {
+ view! {
+
+
+
+
+
+ }
+}
+
+#[component]
+pub fn WelcomeView(fact: String) -> impl IntoView {
+ view! {
+
+
+ }
+}