update calculator result card design

This commit is contained in:
bignutty 2024-12-07 23:54:33 +01:00
parent 87438da5f4
commit 400efb8064
3 changed files with 33 additions and 30 deletions

View file

@ -1,11 +1,12 @@
const { google } = require('#api');
const { paginator } = require('#client');
const { format } = require('#utils/ansi');
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
const { acknowledge } = require('#utils/interactions');
const { link, citation, icon, smallPill, pill, codeblock } = require('#utils/markdown')
const { editOrReply } = require('#utils/message')
const { STATICS, STATIC_ICONS } = require('#utils/statics')
const { STATICS } = require('#utils/statics')
const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants');
@ -136,22 +137,20 @@ function createSearchResultPage(context, result, doodle){
break;
case SEARCH_CARD_TYPES.CALCULATOR:
res = createEmbed("default", context, {
author: {
name: result.query,
iconUrl: STATIC_ICONS.search_calculator
},
description: codeblock("ansi",[result.result]),
footer: renderFooter(context, doodle)
description: `-# ${result.query} =\n**${codeblock("ansi",[format(result.result, "white")])}**`,
footer: {
iconUrl: STATICS.googlecalculator,
text: `Calculator • ${context.application.name}`
}
})
break;
case SEARCH_CARD_TYPES.UNIT_CONVERTER:
res = createEmbed("default", context, {
author: {
name: result.query,
iconUrl: STATIC_ICONS.search_calculator
},
description: `### Unit Converter\n${smallPill(result.units[0])} ${icon("arrow_right")} ${pill(result.units[1])}`,
footer: renderFooter(context, doodle)
description: `-# ${result.units[0]} =\n**${codeblock("ansi",[format(result.units[1], "white")])}**`,
footer: {
iconUrl: STATICS.googlecalculator,
text: `Unit Converter • ${context.application.name}`
}
})
break;
case SEARCH_CARD_TYPES.MAPS:
@ -187,7 +186,7 @@ function createSearchResultPage(context, result, doodle){
break;
case SEARCH_CARD_TYPES.DATA_GENERIC:
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)
})

View file

@ -1,10 +1,11 @@
const { google } = require('#api');
const { paginator } = require('#client');
const { format } = require('#utils/ansi');
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 { STATICS, STATIC_ICONS } = require('#utils/statics')
const { STATICS } = require('#utils/statics')
// TODO: Turn this into a general purpose permissions constant
const { Permissions } = require("detritus-client/lib/constants");
@ -137,22 +138,20 @@ function createSearchResultPage(context, result, doodle){
break;
case SEARCH_CARD_TYPES.CALCULATOR:
res = createEmbed("default", context, {
author: {
name: result.query,
iconUrl: STATIC_ICONS.search_calculator
},
description: codeblock("ansi",[result.result]),
footer: renderFooter(context, doodle)
description: `-# ${result.query} =\n**${codeblock("ansi",[format(result.result, "white")])}**`,
footer: {
iconUrl: STATICS.googlecalculator,
text: `Calculator • ${context.application.name}`
}
})
break;
case SEARCH_CARD_TYPES.UNIT_CONVERTER:
res = createEmbed("default", context, {
author: {
name: result.query,
iconUrl: STATIC_ICONS.search_calculator
},
description: `### Unit Converter\n${smallPill(result.units[0])} ${icon("arrow_right")} ${pill(result.units[1])}`,
footer: renderFooter(context, doodle)
description: `-# ${result.units[0]} =\n**${codeblock("ansi",[format(result.units[1], "white")])}**`,
footer: {
iconUrl: STATICS.googlecalculator,
text: `Unit Converter • ${context.application.name}`
}
})
break;
case SEARCH_CARD_TYPES.MAPS:
@ -188,7 +187,7 @@ function createSearchResultPage(context, result, doodle){
break;
case SEARCH_CARD_TYPES.DATA_GENERIC:
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)
})

View file

@ -68,6 +68,10 @@ const Statics = Object.freeze({
file: "brands/google.png",
revision: 2
},
googlecalculator: {
file: "brands/googlecalculator.png",
revision: 2
},
googledictionary: {
file: "brands/googledictionary.png",
revision: 0
@ -238,6 +242,7 @@ module.exports.STATICS = Object.freeze({
genius: staticAsset(Statics.brands.genius),
google: staticAsset(Statics.brands.google),
googlelens: staticAsset(Statics.brands.googlelens),
googlecalculator: staticAsset(Statics.brands.googlecalculator),
googledictionary: staticAsset(Statics.brands.googledictionary),
googlefinance: staticAsset(Statics.brands.googlefinance),
googlemaps: staticAsset(Statics.brands.googlemaps),