Add fast forward pagination buttons to incidents command
This commit is contained in:
@@ -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<usize>,
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user