diff --git a/src/app.rs b/src/app.rs index 43ec1c8..6bcdb70 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1177,7 +1177,17 @@ fn AlternativeCard( children=move |e| view! {
{e}
} /> - {if is_gateway { + {if alternative.disabled { + // Advertised, not yet takeable: the label + // stays (it says what will be possible), + // the button doesn't act. + view! { + + } + .into_any() + } else if is_gateway { let href = alternative.action.clone().unwrap_or_default(); view! { {button_label.clone()} @@ -1860,6 +1870,9 @@ pub async fn submit_answer( .iter() .find(|a| a.name == alternative) .ok_or_else(|| ServerFnError::new("unknown alternative"))?; + if alt.disabled { + return Err(ServerFnError::new("this alternative isn't open yet")); + } let next = alt.action.clone(); let record_as = alt.record_as.clone(); diff --git a/src/content.rs b/src/content.rs index 10fe99f..2652e8f 100644 --- a/src/content.rs +++ b/src/content.rs @@ -111,6 +111,11 @@ pub struct Alternative { pub description: String, #[serde(default)] pub action: Option