mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 22:53:06 -04:00
[nextgen] mostly implemented
This commit is contained in:
parent
4e62cecf0f
commit
f226d7170a
12 changed files with 194 additions and 50 deletions
|
@ -30,6 +30,7 @@ module.exports = {
|
|||
label: "single sub page",
|
||||
inline: true,
|
||||
visible: true,
|
||||
disableCache: true,
|
||||
resolvePage: ()=>{
|
||||
return [
|
||||
createEmbed("success", context, "smiley")
|
||||
|
@ -42,8 +43,6 @@ module.exports = {
|
|||
// Next to pagination or new row
|
||||
inline: false,
|
||||
visible: (page) => {
|
||||
console.log(page.getAllState());
|
||||
console.log(page.getState("t_1"));
|
||||
return (page.getState("key") === "t_1")
|
||||
},
|
||||
resolvePage: (pg) => {
|
||||
|
@ -76,7 +75,55 @@ module.exports = {
|
|||
createEmbed("default", context, { description: "this is a dynamic sub page " + Math.random()})
|
||||
].map((p)=>page(p));
|
||||
}
|
||||
}
|
||||
},
|
||||
conditional_button_2: {
|
||||
// Button Label
|
||||
label: "Conditional",
|
||||
// Next to pagination or new row
|
||||
inline: false,
|
||||
visible: true,
|
||||
resolvePage: (pg) => {throw "a"}
|
||||
},
|
||||
conditional_button_3: {
|
||||
// Button Label
|
||||
label: "Conditional",
|
||||
// Next to pagination or new row
|
||||
inline: false,
|
||||
visible: true,
|
||||
resolvePage: (pg) => {throw "a"}
|
||||
},
|
||||
conditional_button_4: {
|
||||
// Button Label
|
||||
label: "Conditional",
|
||||
// Next to pagination or new row
|
||||
inline: false,
|
||||
visible: true,
|
||||
resolvePage: (pg) => {throw "a"}
|
||||
},
|
||||
conditional_button_5: {
|
||||
// Button Label
|
||||
label: "Conditional",
|
||||
// Next to pagination or new row
|
||||
inline: false,
|
||||
visible: true,
|
||||
resolvePage: (pg) => {throw "a"}
|
||||
},
|
||||
conditional_button_6: {
|
||||
// Button Label
|
||||
label: "Conditional",
|
||||
// Next to pagination or new row
|
||||
inline: false,
|
||||
visible: true,
|
||||
resolvePage: (pg) => {throw "a"}
|
||||
},
|
||||
conditional_button_7: {
|
||||
// Button Label
|
||||
label: "Conditional",
|
||||
// Next to pagination or new row
|
||||
inline: false,
|
||||
visible: true,
|
||||
resolvePage: (pg) => {throw "a"}
|
||||
},
|
||||
}
|
||||
})
|
||||
}catch(e){
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
const { anime } = require('#api');
|
||||
const { paginator } = require('#client');
|
||||
const { PERMISSION_GROUPS, OMNI_ANIME_FORMAT_TYPES } = require('#constants');
|
||||
const { PERMISSION_GROUPS, OMNI_ANIME_FORMAT_TYPES, COLORS, COLORS_HEX} = require('#constants');
|
||||
|
||||
const { createEmbed, formatPaginationEmbeds, page, hexToEmbedColor } = require('#utils/embed');
|
||||
const { hexToDecimalColor } = require("#utils/color");
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { smallPill, link, pill, stringwrap, stringwrapPreserveWords} = require('#utils/markdown');
|
||||
const { editOrReply } = require('#utils/message');
|
||||
|
||||
const DynamicCardStack = require("../../../labscore/cardstack/DynamicCardStack");
|
||||
const {STATIC_ASSETS} = require("#utils/statics");
|
||||
|
||||
function renderAnimeResultsPage(context, res){
|
||||
let result = createEmbed("default", context, {
|
||||
|
@ -39,7 +41,7 @@ function renderAnimeResultsPage(context, res){
|
|||
if(res.image) result.image = { url: res.image };
|
||||
|
||||
// Render Color
|
||||
if(res.color) result.color = hexToEmbedColor(res.color);
|
||||
if(res.color) result.color = hexToDecimalColor(res.color);
|
||||
|
||||
// Render Episode Metadata
|
||||
if(res.episodes) {
|
||||
|
@ -60,7 +62,8 @@ function renderAnimeResultsPage(context, res){
|
|||
|
||||
return page(result, {}, {
|
||||
episodes_key: res.supplemental.episodes,
|
||||
name: res.title
|
||||
name: res.title,
|
||||
color: hexToDecimalColor(res.color || COLORS_HEX.embed)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -111,10 +114,11 @@ module.exports = {
|
|||
},
|
||||
renderLoadingState: (pg) => {
|
||||
return createEmbed("default", context, {
|
||||
description: `-# ${pg.getState("name")} > **Episodes**`,
|
||||
description: `-# ${pg.getState("name")} › **Episodes**`,
|
||||
image: {
|
||||
url: `https://bignutty.gitlab.io/webstorage4/v2/assets/loading/04_chat_loading.1zn1ocfb72tc.gif`
|
||||
}
|
||||
url: STATIC_ASSETS.card_skeleton
|
||||
},
|
||||
color: pg.getState("color")
|
||||
})
|
||||
},
|
||||
// Will resolve all conditions at paginator creation time
|
||||
|
@ -130,13 +134,16 @@ module.exports = {
|
|||
let i = 0;
|
||||
return [
|
||||
createEmbed("default", context, {
|
||||
description: `-# ${pg.getState("name")} > **Episodes**\n\nepisode page ${i++}`,
|
||||
description: `-# ${pg.getState("name")} › **Episodes**\n\nepisode page ${i++}`,
|
||||
color: pg.getState("color")
|
||||
}),
|
||||
createEmbed("default", context, {
|
||||
description: `-# ${pg.getState("name")} > **Episodes**\n\nepisode page ${i++}`,
|
||||
description: `-# ${pg.getState("name")} › **Episodes**\n\nepisode page ${i++}`,
|
||||
color: pg.getState("color")
|
||||
}),
|
||||
createEmbed("default", context, {
|
||||
description: `-# ${pg.getState("name")} > **Episodes**\n\nepisode page ${i++}`,
|
||||
description: `-# ${pg.getState("name")} › **Episodes**\n\nepisode page ${i++}`,
|
||||
color: pg.getState("color")
|
||||
})
|
||||
].map((p)=>page(p));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const { maps, mapsSupplemental } = require('#api');
|
||||
const { PERMISSION_GROUPS } = require('#constants');
|
||||
|
||||
const { createEmbed, hexToEmbedColor } = require('#utils/embed');
|
||||
const { hexToDecimalColor } = require("#utils/color");
|
||||
const { createEmbed } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { link, icon, iconAsEmojiObject, citation, stringwrap } = require('#utils/markdown');
|
||||
const { editOrReply } = require('#utils/message')
|
||||
|
@ -18,7 +19,7 @@ function renderPlaceCard(context, place) {
|
|||
},
|
||||
description: `${place.address.full}`,
|
||||
url: place.url,
|
||||
color: hexToEmbedColor(place.style.color)
|
||||
color: hexToDecimalColor(place.style.color)
|
||||
})]
|
||||
|
||||
if (place.display_type) {
|
||||
|
|
|
@ -2,7 +2,8 @@ const { movie } = require('#api');
|
|||
const { paginator } = require('#client');
|
||||
const { PERMISSION_GROUPS, OMNI_ANIME_FORMAT_TYPES, OMNI_MOVIE_TYPES } = require('#constants');
|
||||
|
||||
const { createEmbed, formatPaginationEmbeds, page, hexToEmbedColor } = require('#utils/embed');
|
||||
const { hexToDecimalColor } = require("#utils/color");
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { smallPill, pill } = require('#utils/markdown');
|
||||
const { editOrReply } = require('#utils/message');
|
||||
|
@ -28,7 +29,7 @@ function renderMovieResultsPage(context, res){
|
|||
if(res.image) result.image = { url: res.image };
|
||||
|
||||
// Render Color
|
||||
if(res.color) result.color = hexToEmbedColor(res.color);
|
||||
if(res.color) result.color = hexToDecimalColor(res.color);
|
||||
|
||||
return page(result);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue