Responsible note under the title; followup pages out of the nav until a chain exists
Deploy / deploy (push) Successful in 1m2s
Deploy / deploy (push) Successful in 1m2s
- The "Asked by X" line moves from the page footer to directly below the hero, where the question it belongs to is. - New Question.followup flag: a post-submission page only appears in the question nav once the visitor's context actually carries an answer chain - nobody qualifies for "what happens now" before something happened. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e237a4b3c0
commit
811c48be77
+17
-11
@@ -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! { <leptos_meta::Script src="/swiper-element-bundle.min.js"/> })}
|
||||
<Hero
|
||||
@@ -175,6 +177,12 @@ fn QuestionView(
|
||||
description=question.description.clone()
|
||||
show_yes=question_id == "/"
|
||||
/>
|
||||
{question
|
||||
.responsible
|
||||
.clone()
|
||||
.map(|r| {
|
||||
view! { <ResponsibleNote responsible=r/> }
|
||||
})}
|
||||
<div class="alternatives">
|
||||
<For
|
||||
each={
|
||||
@@ -212,13 +220,7 @@ fn QuestionView(
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<QuestionNav current_id=question_id/>
|
||||
{question
|
||||
.responsible
|
||||
.clone()
|
||||
.map(|r| {
|
||||
view! { <ResponsibleNote responsible=r/> }
|
||||
})}
|
||||
<QuestionNav current_id=question_id has_chain=has_chain/>
|
||||
}
|
||||
.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! {
|
||||
<Suspense fallback=|| ()>
|
||||
{move || {
|
||||
@@ -1432,9 +1434,12 @@ pub async fn get_question(path: String) -> Result<Option<Question>, 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<Vec<(String, String)>, ServerFnError> {
|
||||
pub async fn list_qualifying_questions(
|
||||
has_chain: bool,
|
||||
) -> Result<Vec<(String, String)>, 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<Vec<(String, String)>, 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();
|
||||
|
||||
Reference in New Issue
Block a user