From 438feefa8366fc005bb0e30586f88a43dc49e33e Mon Sep 17 00:00:00 2001 From: tresabhi Date: Mon, 10 Jul 2023 01:44:05 +0000 Subject: [PATCH] feat: today embeds --- src/commands/today.tsx | 3 ++- src/components/Breakdown/components/Row.tsx | 10 ++++++++-- src/components/Wrapper.tsx | 8 ++++++-- src/renderers/stats.tsx | 2 +- src/renderers/today.tsx | 12 ++++++++++-- src/routes/today.tsx | 15 +++++++++++++++ src/server.ts | 3 ++- src/stitches.config.ts | 5 ++++- 8 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 src/routes/today.tsx diff --git a/src/commands/today.tsx b/src/commands/today.tsx index 613014928..7c10612cd 100644 --- a/src/commands/today.tsx +++ b/src/commands/today.tsx @@ -1,4 +1,5 @@ import { SlashCommandBuilder } from 'discord.js'; +import { CYCLIC_API } from '../constants/cyclic.js'; import getWargamingResponse from '../core/blitz/getWargamingResponse.js'; import addUsernameChoices from '../core/discord/addUsernameChoices.js'; import autocompleteUsername from '../core/discord/autocompleteUsername.js'; @@ -34,7 +35,7 @@ export const todayCommand: CommandRegistry = { return [ await today(player), primaryButton(path, 'Refresh'), - // linkButton(`${CYCLIC_API}/${path}`, 'Embed'), + linkButton(`${CYCLIC_API}/${path}`, 'Embed'), linkButton( `https://www.blitzstars.com/player/${player.server}/${nickname}`, 'BlitzStars', diff --git a/src/components/Breakdown/components/Row.tsx b/src/components/Breakdown/components/Row.tsx index 31c904724..ef39602cd 100644 --- a/src/components/Breakdown/components/Row.tsx +++ b/src/components/Breakdown/components/Row.tsx @@ -1,5 +1,5 @@ import getWN8Percentile from '../../../core/blitz/getWN8Percentile.js'; -import { theme } from '../../../stitches.config.js'; +import { theme, themeTransparent } from '../../../stitches.config.js'; import { RowDiscriminator } from './RowDiscriminator.js'; import { RowStat } from './RowStat.js'; @@ -16,6 +16,7 @@ export interface RowProps { icon?: string; minimized: boolean; isListing: boolean; + naked?: boolean; } export function Row({ @@ -31,6 +32,7 @@ export function Row({ battles, careerBattles, icon, + naked, }: RowProps) { return (
{children} diff --git a/src/renderers/stats.tsx b/src/renderers/stats.tsx index 314bf7077..5756da28a 100644 --- a/src/renderers/stats.tsx +++ b/src/renderers/stats.tsx @@ -156,7 +156,7 @@ export default async function stats( ); return naked ? ( - overview + {overview} ) : ( 4} key={tankId} @@ -142,7 +146,11 @@ export default async function today({ server, id }: ResolvedPlayer) { ), ); - return ( + return naked ? ( + + {rows.slice(1)} + + ) : ( ; @@ -20,7 +21,7 @@ export interface RouteRegistry const app = express(); -([statsRoute] as RouteRegistry[]).forEach((registry) => { +([statsRoute, todayRoute] as RouteRegistry[]).forEach((registry) => { if (!(isDev() ? registry.inDevelopment : registry.inProduction)) return; app.get(registry.route, async (req, res) => { diff --git a/src/stitches.config.ts b/src/stitches.config.ts index c6190584b..673116268 100644 --- a/src/stitches.config.ts +++ b/src/stitches.config.ts @@ -1,4 +1,4 @@ -import { amberDark, slate, slateDark } from '@radix-ui/colors'; +import { amberDark, slate, slateDark, slateDarkA } from '@radix-ui/colors'; import { createBorderStyles, createColors } from 'bepaint'; // this isn't really a stitches config, but the object is compliant @@ -6,5 +6,8 @@ export const theme = { colors: createColors(slateDark), borderStyles: createBorderStyles(slateDark), }; +export const themeTransparent = { + colors: createColors(slateDarkA), +}; export const themeLight = { colors: createColors(slate) }; export const themeAmber = { colors: createColors(amberDark) };