{ "Moderation" }
if *list_loading {
{ "Loading reports…" }
} else if let Some(err) = (*list_error).clone() {
{ err }
} else if let Some(ref data) = *list {
if data.reports.is_empty() {
{ "No reported quotes." }
} else {
{ for data.reports.iter().map(|r| {
render_row(r, &on_row_click, &modal)
}) }
if data.total_pages > 1 {
}
}
} else {
{ "Loading…" }
}
// ── Detail modal ──────────────────────────────────────────────────
{
match modal_snapshot {
ModalState::Closed => html! {},
ModalState::Loading(_) => html! {
},
ModalState::Open(ref details)
| ModalState::HideSuccess(ref details)
| ModalState::Error(ref details, _) => {
let quote_id = details.quote.id.clone();
let is_hide_success = matches!(modal_snapshot, ModalState::HideSuccess(_));
let modal_err = match modal_snapshot {
ModalState::Error(_, ref e) => Some(e.clone()),
_ => None,
};
render_modal(
details,
is_hide_success,
modal_err,
*action_loading,
&on_close,
{
let on_delete = on_delete.clone();
let qid = quote_id.clone();
Callback::from(move |_: MouseEvent| on_delete.emit(qid.clone()))
},
{
let on_hide = on_hide.clone();
let qid = quote_id.clone();
Callback::from(move |_: MouseEvent| on_hide.emit(qid.clone()))
},
{
let on_dismiss = on_dismiss.clone();
let qid = quote_id.clone();
Callback::from(move |_: MouseEvent| on_dismiss.emit(qid.clone()))
},
)
}
}
}
}
}
// ── Helper: render a single report summary row ────────────────────────────────
/// Renders a single row in the moderation list table.
fn render_row(
r: &ReportSummary,
on_row_click: &Callback