31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import * as StarKitten from '@star-kitten/lib/discord';
|
|
import type { ExecutableInteraction } from '@star-kitten/lib/discord';
|
|
import { createActionRow, createButton, createContainer, createTextDisplay } from '@star-kitten/lib/discord/components';
|
|
import type { PageContext } from '@star-kitten/lib/discord/pages';
|
|
import { type Appraisal } from '@star-kitten/lib/eve/third-party/janice.js';
|
|
import { formatNumberToShortForm } from '@star-kitten/lib/util/text.js';
|
|
|
|
export function renderAppraisal(appraisal: Appraisal, pageCtx: PageContext<any>, interaction: ExecutableInteraction) {
|
|
const formatter = new Intl.NumberFormat(interaction.locale || 'en-US', {
|
|
maximumFractionDigits: 2,
|
|
minimumFractionDigits: 2,
|
|
});
|
|
const world = 'world';
|
|
return StarKitten.createElement(
|
|
'ActionRow',
|
|
{},
|
|
StarKitten.createElement(
|
|
'Container',
|
|
{ color: '0x1da57a' },
|
|
StarKitten.createElement('TextDisplay', {}, '' + `Hello ${world}` + ''),
|
|
pageCtx.state.currentPage !== 'share'
|
|
? StarKitten.createElement(
|
|
'ActionRow',
|
|
{},
|
|
StarKitten.createElement('Button', { key: 'share', disabled: '{!unknown}' }, 'Share in Channel'),
|
|
)
|
|
: undefined,
|
|
),
|
|
);
|
|
}
|