diff --git a/src/app.rs b/src/app.rs index 9334160..bc8af67 100644 --- a/src/app.rs +++ b/src/app.rs @@ -168,6 +168,8 @@ fn QuestionView( // on pages where some alternative actually declares a deck. let needs_swiper = question.alternatives.iter().any(|a| a.images.len() > 1); + let has_chain = parent_hash.is_some(); + view! { {needs_swiper.then(|| view! { })} + {question + .responsible + .clone() + .map(|r| { + view! { } + })}
- - {question - .responsible - .clone() - .map(|r| { - view! { } - })} + } .into_any() } @@ -227,8 +229,8 @@ fn QuestionView( /// small nav - how a concern reaches the people it speaks to without /// claiming front-page space (an owner also sees the gated desks here). #[component] -fn QuestionNav(current_id: String) -> impl IntoView { - let nav = Resource::new(|| (), |_| list_qualifying_questions()); +fn QuestionNav(current_id: String, has_chain: bool) -> impl IntoView { + let nav = Resource::new(move || has_chain, list_qualifying_questions); view! { {move || { @@ -1432,9 +1434,12 @@ pub async fn get_question(path: String) -> Result, ServerFnErro /// Every question the current visitor qualifies for, as (id, name) - /// the site nav's data. Context-dependent: an owner session sees the -/// gated pages too, an anonymous visitor only the public ones. +/// gated pages too, and `followup` pages only appear once the visitor +/// carries an answer chain. #[server] -pub async fn list_qualifying_questions() -> Result, ServerFnError> { +pub async fn list_qualifying_questions( + has_chain: bool, +) -> Result, ServerFnError> { use crate::auth::{User, SESSION_USER_KEY}; use crate::content::is_qualified; use crate::server::AppState; @@ -1451,6 +1456,7 @@ pub async fn list_qualifying_questions() -> Result, Server .load() .values() .filter(|q| is_qualified(user.as_ref(), q)) + .filter(|q| !q.followup || has_chain) .map(|q| (q.id.clone(), q.name.clone())) .collect(); out.sort(); diff --git a/src/content.rs b/src/content.rs index 03f789f..251c660 100644 --- a/src/content.rs +++ b/src/content.rs @@ -25,6 +25,11 @@ pub struct Question { /// on the page. #[serde(default)] pub responsible: Option, + /// A page that only makes sense after answering something (the + /// post-submission pages) - kept out of the question nav unless the + /// visitor's context carries an answer chain. + #[serde(default)] + pub followup: bool, } #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/style/main.css b/style/main.css index f4c9344..6f794aa 100644 --- a/style/main.css +++ b/style/main.css @@ -274,6 +274,7 @@ main.not-found { color: var(--ink-dim); font-size: 0.85rem; line-height: 1.6; + margin: 0.6rem 1rem 1.8rem; } .question-responsible a {