mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
[cardstack] add built-in buttons constant
This commit is contained in:
parent
3e0078979c
commit
4ca49289c0
1 changed files with 8 additions and 4 deletions
|
@ -15,9 +15,14 @@ const {DISCORD_INVITES} = require("#constants");
|
||||||
*/
|
*/
|
||||||
const activeStacks = new WeakMap();
|
const activeStacks = new WeakMap();
|
||||||
|
|
||||||
|
const BUILT_IN_BUTTON_TYPES = Object.freeze({
|
||||||
|
NEXT_PAGE: "next",
|
||||||
|
PREVIOUS_PAGE: "previous"
|
||||||
|
})
|
||||||
|
|
||||||
const DEFAULT_BUTTON_ICON_MAPPINGS = Object.freeze({
|
const DEFAULT_BUTTON_ICON_MAPPINGS = Object.freeze({
|
||||||
"next": "button_chevron_right",
|
[BUILT_IN_BUTTON_TYPES.NEXT_PAGE]: "button_chevron_right",
|
||||||
"previous": "button_chevron_left"
|
[BUILT_IN_BUTTON_TYPES.PREVIOUS_PAGE]: "button_chevron_left"
|
||||||
});
|
});
|
||||||
|
|
||||||
const STACK_CACHE_KEYS = Object.freeze({
|
const STACK_CACHE_KEYS = Object.freeze({
|
||||||
|
@ -397,8 +402,7 @@ class DynamicCardStack {
|
||||||
//this.lastInteraction = Date.now();
|
//this.lastInteraction = Date.now();
|
||||||
|
|
||||||
// Built-in Buttons
|
// Built-in Buttons
|
||||||
// TODO: derive this from a constant
|
if(Object.values(BUILT_IN_BUTTON_TYPES).includes(ctx.data.customId)){
|
||||||
if(["next","previous"].includes(ctx.data.customId)){
|
|
||||||
switch(ctx.data.customId){
|
switch(ctx.data.customId){
|
||||||
case "next":
|
case "next":
|
||||||
return ctx.respond({
|
return ctx.respond({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue