mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 14:43:05 -04:00
update calculator result card design
This commit is contained in:
parent
87438da5f4
commit
400efb8064
3 changed files with 33 additions and 30 deletions
|
@ -1,11 +1,12 @@
|
||||||
const { google } = require('#api');
|
const { google } = require('#api');
|
||||||
const { paginator } = require('#client');
|
const { paginator } = require('#client');
|
||||||
|
const { format } = require('#utils/ansi');
|
||||||
|
|
||||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||||
const { acknowledge } = require('#utils/interactions');
|
const { acknowledge } = require('#utils/interactions');
|
||||||
const { link, citation, icon, smallPill, pill, codeblock } = require('#utils/markdown')
|
const { link, citation, icon, smallPill, pill, codeblock } = require('#utils/markdown')
|
||||||
const { editOrReply } = require('#utils/message')
|
const { editOrReply } = require('#utils/message')
|
||||||
const { STATICS, STATIC_ICONS } = require('#utils/statics')
|
const { STATICS } = require('#utils/statics')
|
||||||
|
|
||||||
const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants');
|
const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants');
|
||||||
|
|
||||||
|
@ -136,22 +137,20 @@ function createSearchResultPage(context, result, doodle){
|
||||||
break;
|
break;
|
||||||
case SEARCH_CARD_TYPES.CALCULATOR:
|
case SEARCH_CARD_TYPES.CALCULATOR:
|
||||||
res = createEmbed("default", context, {
|
res = createEmbed("default", context, {
|
||||||
author: {
|
description: `-# ${result.query} =\n**${codeblock("ansi",[format(result.result, "white")])}**`,
|
||||||
name: result.query,
|
footer: {
|
||||||
iconUrl: STATIC_ICONS.search_calculator
|
iconUrl: STATICS.googlecalculator,
|
||||||
},
|
text: `Calculator • ${context.application.name}`
|
||||||
description: codeblock("ansi",[result.result]),
|
}
|
||||||
footer: renderFooter(context, doodle)
|
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case SEARCH_CARD_TYPES.UNIT_CONVERTER:
|
case SEARCH_CARD_TYPES.UNIT_CONVERTER:
|
||||||
res = createEmbed("default", context, {
|
res = createEmbed("default", context, {
|
||||||
author: {
|
description: `-# ${result.units[0]} =\n**${codeblock("ansi",[format(result.units[1], "white")])}**`,
|
||||||
name: result.query,
|
footer: {
|
||||||
iconUrl: STATIC_ICONS.search_calculator
|
iconUrl: STATICS.googlecalculator,
|
||||||
},
|
text: `Unit Converter • ${context.application.name}`
|
||||||
description: `### Unit Converter\n${smallPill(result.units[0])} ${icon("arrow_right")} ${pill(result.units[1])}`,
|
}
|
||||||
footer: renderFooter(context, doodle)
|
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case SEARCH_CARD_TYPES.MAPS:
|
case SEARCH_CARD_TYPES.MAPS:
|
||||||
|
@ -187,7 +186,7 @@ function createSearchResultPage(context, result, doodle){
|
||||||
break;
|
break;
|
||||||
case SEARCH_CARD_TYPES.DATA_GENERIC:
|
case SEARCH_CARD_TYPES.DATA_GENERIC:
|
||||||
res = createEmbed("default", context, {
|
res = createEmbed("default", context, {
|
||||||
description: `-# ${result.fact.category} › **${result.fact.type}**\n# ${result.fact.result}`,
|
description: `-# ${result.fact.category} ${(result.fact.type ? `› **${result.fact.type}**` : '')}\n# ${result.fact.result}`,
|
||||||
footer: renderFooter(context, doodle)
|
footer: renderFooter(context, doodle)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
const { google } = require('#api');
|
const { google } = require('#api');
|
||||||
const { paginator } = require('#client');
|
const { paginator } = require('#client');
|
||||||
|
const { format } = require('#utils/ansi');
|
||||||
|
|
||||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed')
|
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed')
|
||||||
const { link, citation, icon, stringwrap, codeblock, pill, smallPill } = require('#utils/markdown')
|
const { link, citation, icon, codeblock, pill, smallPill } = require('#utils/markdown')
|
||||||
const { editOrReply } = require('#utils/message')
|
const { editOrReply } = require('#utils/message')
|
||||||
const { STATICS, STATIC_ICONS } = require('#utils/statics')
|
const { STATICS } = require('#utils/statics')
|
||||||
|
|
||||||
// TODO: Turn this into a general purpose permissions constant
|
// TODO: Turn this into a general purpose permissions constant
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
@ -137,22 +138,20 @@ function createSearchResultPage(context, result, doodle){
|
||||||
break;
|
break;
|
||||||
case SEARCH_CARD_TYPES.CALCULATOR:
|
case SEARCH_CARD_TYPES.CALCULATOR:
|
||||||
res = createEmbed("default", context, {
|
res = createEmbed("default", context, {
|
||||||
author: {
|
description: `-# ${result.query} =\n**${codeblock("ansi",[format(result.result, "white")])}**`,
|
||||||
name: result.query,
|
footer: {
|
||||||
iconUrl: STATIC_ICONS.search_calculator
|
iconUrl: STATICS.googlecalculator,
|
||||||
},
|
text: `Calculator • ${context.application.name}`
|
||||||
description: codeblock("ansi",[result.result]),
|
}
|
||||||
footer: renderFooter(context, doodle)
|
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case SEARCH_CARD_TYPES.UNIT_CONVERTER:
|
case SEARCH_CARD_TYPES.UNIT_CONVERTER:
|
||||||
res = createEmbed("default", context, {
|
res = createEmbed("default", context, {
|
||||||
author: {
|
description: `-# ${result.units[0]} =\n**${codeblock("ansi",[format(result.units[1], "white")])}**`,
|
||||||
name: result.query,
|
footer: {
|
||||||
iconUrl: STATIC_ICONS.search_calculator
|
iconUrl: STATICS.googlecalculator,
|
||||||
},
|
text: `Unit Converter • ${context.application.name}`
|
||||||
description: `### Unit Converter\n${smallPill(result.units[0])} ${icon("arrow_right")} ${pill(result.units[1])}`,
|
}
|
||||||
footer: renderFooter(context, doodle)
|
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case SEARCH_CARD_TYPES.MAPS:
|
case SEARCH_CARD_TYPES.MAPS:
|
||||||
|
@ -188,7 +187,7 @@ function createSearchResultPage(context, result, doodle){
|
||||||
break;
|
break;
|
||||||
case SEARCH_CARD_TYPES.DATA_GENERIC:
|
case SEARCH_CARD_TYPES.DATA_GENERIC:
|
||||||
res = createEmbed("default", context, {
|
res = createEmbed("default", context, {
|
||||||
description: `-# ${result.fact.category} › **${result.fact.type}**\n# ${result.fact.result}`,
|
description: `-# ${result.fact.category} ${(result.fact.type ? `› **${result.fact.type}**` : '')}\n# ${result.fact.result}`,
|
||||||
footer: renderFooter(context, doodle)
|
footer: renderFooter(context, doodle)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,10 @@ const Statics = Object.freeze({
|
||||||
file: "brands/google.png",
|
file: "brands/google.png",
|
||||||
revision: 2
|
revision: 2
|
||||||
},
|
},
|
||||||
|
googlecalculator: {
|
||||||
|
file: "brands/googlecalculator.png",
|
||||||
|
revision: 2
|
||||||
|
},
|
||||||
googledictionary: {
|
googledictionary: {
|
||||||
file: "brands/googledictionary.png",
|
file: "brands/googledictionary.png",
|
||||||
revision: 0
|
revision: 0
|
||||||
|
@ -238,6 +242,7 @@ module.exports.STATICS = Object.freeze({
|
||||||
genius: staticAsset(Statics.brands.genius),
|
genius: staticAsset(Statics.brands.genius),
|
||||||
google: staticAsset(Statics.brands.google),
|
google: staticAsset(Statics.brands.google),
|
||||||
googlelens: staticAsset(Statics.brands.googlelens),
|
googlelens: staticAsset(Statics.brands.googlelens),
|
||||||
|
googlecalculator: staticAsset(Statics.brands.googlecalculator),
|
||||||
googledictionary: staticAsset(Statics.brands.googledictionary),
|
googledictionary: staticAsset(Statics.brands.googledictionary),
|
||||||
googlefinance: staticAsset(Statics.brands.googlefinance),
|
googlefinance: staticAsset(Statics.brands.googlefinance),
|
||||||
googlemaps: staticAsset(Statics.brands.googlemaps),
|
googlemaps: staticAsset(Statics.brands.googlemaps),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue