mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-25 22:37:03 -04:00
[nextgen] Add DynamicCardStack
This commit is contained in:
parent
048073b522
commit
4c8a9927ea
15 changed files with 874 additions and 94 deletions
7
labscore/utils/color.js
Normal file
7
labscore/utils/color.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports.hexToDecimalColor = (color)=>{
|
||||
return parseInt(color.split("#")[1], 16)
|
||||
}
|
||||
|
||||
module.exports.decimalToHexColor = (color)=>{
|
||||
return "#" + color.toString(16);
|
||||
}
|
|
@ -180,12 +180,9 @@ module.exports.formatPaginationEmbeds = function(embeds){
|
|||
}
|
||||
|
||||
// Creates a page for our paginator. simple helper so we dont have to do {embeds:[]} every time
|
||||
module.exports.page = function(embed, message = {}){
|
||||
module.exports.page = function(embed, message = {}, metadata = {}){
|
||||
return Object.assign(message, {
|
||||
embeds: [embed]
|
||||
embeds: [embed],
|
||||
_meta: metadata,
|
||||
})
|
||||
}
|
||||
|
||||
module.exports.hexToEmbedColor = (color)=>{
|
||||
return parseInt(color.split("#")[1], 16)
|
||||
}
|
|
@ -24,7 +24,7 @@ function _icon(icon){
|
|||
|
||||
// Ensures potentially user-provided content won't escape pill components
|
||||
function _escapeCodeblock(content){
|
||||
return content.toString().replace(/\`/g, 'ˋ');
|
||||
return content.toString().replace(/`/g, 'ˋ');
|
||||
}
|
||||
|
||||
module.exports.icon = _icon;
|
||||
|
@ -33,11 +33,10 @@ module.exports.iconAsEmojiObject = function(icon){
|
|||
let i = _icon(icon);
|
||||
|
||||
return {
|
||||
id: i.replace(/<:[a-z0-9_]*:([0-9]*)>/g,"$1"),
|
||||
name: i,
|
||||
animated: false, // TODO: fix this for animated emoji if we ever need them
|
||||
id: i.replace(/<a?:[a-z0-9_]*:([0-9]*)>/g,"$1"),
|
||||
name: "i",
|
||||
animated: i.startsWith("<a:")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,7 +55,7 @@ module.exports.weatherIcon = function(icon){
|
|||
}
|
||||
|
||||
module.exports.highlight = function(content = ""){
|
||||
return "`" + content.toString().replace(/\`/g, 'ˋ') + "`"
|
||||
return "`" + content.toString().replace(/`/g, 'ˋ') + "`"
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,6 +76,16 @@ module.exports.link = function(url, masked, tooltip = "", embed = false){
|
|||
return url
|
||||
}
|
||||
|
||||
module.exports.TIMESTAMP_FLAGS = Object.freeze({
|
||||
SHORT_TIME: "t",
|
||||
LONG_TIME: "T",
|
||||
SHORT_DATE: "d",
|
||||
LONG_DATE: "D",
|
||||
SHORT_DATE_TIME: "f",
|
||||
LONG_DATE_TIME: "F",
|
||||
RELATIVE_TIME: "R"
|
||||
})
|
||||
|
||||
module.exports.timestamp = function(time, flag = "t"){
|
||||
return `<t:${Math.floor(time/1000)}:${flag}>`
|
||||
}
|
||||
|
|
|
@ -10,6 +10,10 @@ const Statics = Object.freeze({
|
|||
}
|
||||
},
|
||||
assets: {
|
||||
card_skeleton: {
|
||||
file: "loading/04_chat_loading.1zn1ocfb72tc.gif",
|
||||
revision: 0
|
||||
},
|
||||
chat_loading: {
|
||||
file: "loading/05_chat_loading.7y2ji893rho0.gif",
|
||||
revision: 0
|
||||
|
@ -291,6 +295,7 @@ module.exports.STATIC_ICONS = Object.freeze({
|
|||
})
|
||||
|
||||
module.exports.STATIC_ASSETS = Object.freeze({
|
||||
card_skeleton: staticAsset(Statics.assets.card_skeleton),
|
||||
chat_loading: staticAsset(Statics.assets.chat_loading),
|
||||
chat_loading_small: staticAsset(Statics.assets.chat_loading_small),
|
||||
image_loading: staticAsset(Statics.assets.image_loading),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue