diff --git a/crates/dizey-core/src/store/mod.rs b/crates/dizey-core/src/store/mod.rs index b93f7bb..7f8cb67 100644 --- a/crates/dizey-core/src/store/mod.rs +++ b/crates/dizey-core/src/store/mod.rs @@ -341,12 +341,12 @@ pub trait Store: BoardReads + DetailReads + 'static { at: OffsetDateTime, ) -> Result>; - /// Appends one line to a task's activity trail. `actor_id` is `None` when - /// the system did it rather than a person. /// What a delete would take with it, for the confirmation step. Reads /// only; nothing here writes. async fn deletion_cost(&self, task_id: &str) -> Result>; + /// Appends one line to a task's activity trail. `actor_id` is `None` when + /// the system did it rather than a person. async fn record_activity( &self, task_id: &str, diff --git a/crates/dizey-web/src/board.rs b/crates/dizey-web/src/board.rs index 8e1b932..4eb4702 100644 --- a/crates/dizey-web/src/board.rs +++ b/crates/dizey-web/src/board.rs @@ -120,6 +120,11 @@ impl Filter { #[component] pub fn Board() -> impl IntoView { let board = Resource::new(|| (), |_| async move { current_board().await }); + // Which card is open in the detail modal, if any. It lives out here, above + // the suspense boundary: a refetch rebuilds `BoardScreen` from scratch, and + // a signal owned by that component would be born empty again — closing the + // modal every time something inside it saved. + let opened = RwSignal::new(None::); view! { impl IntoView { {move || Suspend::new(async move { match board.await { Ok(Ok(snapshot)) => { - view! { } + view! { + + } .into_any() } Ok(Err(refusal)) => { @@ -156,14 +167,13 @@ pub fn Board() -> impl IntoView { #[component] fn BoardScreen( snapshot: BoardSnapshot, + opened: RwSignal>, on_change: impl Fn() + Copy + Send + Sync + 'static, ) -> impl IntoView { let BoardSnapshot { view, me, today } = snapshot; let filter = RwSignal::new(Filter::All); // Which column has its composer open, if any. let composing = RwSignal::new(None::); - // Which card is open in the detail modal, if any. - let opened = RwSignal::new(None::); let may_write = me.role.can_write_tasks(); let my_id = StoredValue::new(me.id.clone()); diff --git a/crates/dizey-web/src/detail.rs b/crates/dizey-web/src/detail.rs index 2d4d69d..ece80d8 100644 --- a/crates/dizey-web/src/detail.rs +++ b/crates/dizey-web/src/detail.rs @@ -432,6 +432,29 @@ pub async fn delete_task(task_id: String) -> Result, ServerFnErr // -- the screen ------------------------------------------------------------- +/// Whatever a refused call said, rendered where the form that asked for it is. +/// A refusal shown at the far end of a scrolling modal is a refusal nobody +/// reads: the person clicked "Link a task" and the sentence has to land under +/// that button, not under the activity trail. +fn refused(action: ServerAction) -> impl IntoView +where + S: leptos::server_fn::ServerFn> + Send + Sync + Clone + 'static, + S::Error: Clone + Send + Sync + 'static, +{ + move || { + action + .value() + .get() + .and_then(|answer| match answer { + Ok(refusal) => refusal, + // The call never arrived, which is not the person's mistake and + // is not a sentence about their task. + Err(_) => Some(Refusal::Unavailable), + }) + .map(|refusal| view! { }) + } +} + /// The modal. `esc` closes it, as the artboard's chip says. #[component] pub fn TaskDetailModal( @@ -451,27 +474,22 @@ pub fn TaskDetailModal( on_change(); }; - view! { -