diff --git a/quotesdb/src/bin/ui/pages/submit.rs b/quotesdb/src/bin/ui/pages/submit.rs index d60a574..6759e59 100644 --- a/quotesdb/src/bin/ui/pages/submit.rs +++ b/quotesdb/src/bin/ui/pages/submit.rs @@ -50,8 +50,8 @@ pub fn submit_page() -> Html { let tags_val = (*tags).clone(); let auth_val = (*custom_auth).clone(); - if text_val.is_empty() || author_val.is_empty() { - error.set(Some("Text and author are required.".to_string())); + if text_val.is_empty() { + error.set(Some("Quote text is required.".to_string())); return; } @@ -63,7 +63,11 @@ pub fn submit_page() -> Html { let input = CreateQuoteInput { text: text_val, - author: author_val, + author: if author_val.is_empty() { + "Anonymous".to_string() + } else { + author_val + }, source: if source_val.is_empty() { None } else { @@ -124,8 +128,8 @@ pub fn submit_page() -> Html { > { "View your quote" } > - to={Route::Submit} classes="btn"> - { "Submit another" } + to={Route::Browse} classes="btn"> + { "Browse all quotes" } > @@ -160,7 +164,7 @@ pub fn submit_page() -> Html {
- + Html { author.set(input.value()); }) }} - required=true />
@@ -197,12 +200,11 @@ pub fn submit_page() -> Html {
- + Html {