From c5d699292f62b42a6f17e4bb1b4384d08bfcee8d Mon Sep 17 00:00:00 2001 From: Rafael Bradley Date: Sat, 23 Aug 2025 02:15:40 -0300 Subject: [PATCH] Add fast forward pagination buttons to incidents command --- src/groups/moderation/components.rs | 2 +- src/groups/moderation/mod.rs | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/groups/moderation/components.rs b/src/groups/moderation/components.rs index 0a2f523..d620000 100644 --- a/src/groups/moderation/components.rs +++ b/src/groups/moderation/components.rs @@ -12,7 +12,7 @@ use crate::{ #[derive(Debug)] pub struct ArrowIncidentButton { - pub arrow: char, + pub arrow: &'static str, pub user_id: u64, pub go_to: Option, } diff --git a/src/groups/moderation/mod.rs b/src/groups/moderation/mod.rs index dad38a0..df2a8b0 100644 --- a/src/groups/moderation/mod.rs +++ b/src/groups/moderation/mod.rs @@ -33,7 +33,15 @@ pub(super) async fn get_incident_page( .embed(incident_embed(incident)) .component( ArrowIncidentButton { - arrow: '<', + arrow: "<<", + user_id, + go_to: if page_index > 0 { Some(0) } else { None }, + }, + 1, + ) + .component( + ArrowIncidentButton { + arrow: "<", user_id, go_to: if page_index > 0 { Some(page_index - 1) @@ -52,11 +60,23 @@ pub(super) async fn get_incident_page( ) .component( ArrowIncidentButton { - arrow: '>', + arrow: ">", user_id, go_to: incidents.get(page_index + 1).map(|_| page_index + 1), }, 1, + ) + .component( + ArrowIncidentButton { + arrow: ">>", + user_id, + go_to: if page_index + 1 < incidents.len() { + Some(incidents.len() - 1) + } else { + None + }, + }, + 1, ); if incident.r#type == UserIncidentType::Ban {