diff --git a/api/profile.ts b/api/profile.ts index 6716429..4f013d1 100644 --- a/api/profile.ts +++ b/api/profile.ts @@ -15,6 +15,7 @@ export interface query { icon_color?: string text_color?: string cache_seconds?: string + title?: string // Mater bg_color?: string @@ -34,6 +35,7 @@ export default async (req: Request, res: Respo icon_color, text_color, cache_seconds, + title, // Master bg_color, @@ -59,11 +61,12 @@ export default async (req: Request, res: Respo hide_border: parseBoolean(hide_border), hide_rank: parseBoolean(hide_rank), line_height: parseNumber(line_height), + title, title_color, icon_color, text_color, bg_color, - theme + theme, }).render() )) } catch (err) { diff --git a/api/top-langs.ts b/api/top-langs.ts index e53ab88..c616678 100644 --- a/api/top-langs.ts +++ b/api/top-langs.ts @@ -20,6 +20,7 @@ export interface query { theme?: keyof typeof themes cache_seconds?: string layout?: string + title?: string } export default async (req: Request, res: Response) => { @@ -35,7 +36,8 @@ export default async (req: Request, res: Respo language_count, theme, cache_seconds, - layout + layout, + title, } = req.query prepareResponse(res) @@ -53,6 +55,7 @@ export default async (req: Request, res: Respo layout, text_color, theme, + title, title_color, bg_color, hide_border: parseBoolean(hide_border), diff --git a/src/cards/ProfileCard.tsx b/src/cards/ProfileCard.tsx index ea8e5ab..ee73724 100644 --- a/src/cards/ProfileCard.tsx +++ b/src/cards/ProfileCard.tsx @@ -18,6 +18,7 @@ interface ProfileCardOptions extends CardOptions { line_height?: number icon_color?: string text_color?: string + title?: string } export default class ProfileCard extends Card { @@ -39,9 +40,8 @@ export default class ProfileCard extends Card { private recentXp: number, private options: ProfileCardOptions ) { - super( - options - ) + + super(options) // This Element this.stats = { @@ -64,7 +64,7 @@ export default class ProfileCard extends Card { options.hide_rank ? 0 : 120 ) - this.title = `${encodeHTML(this.username)}${ + this.title = this.options.title ?? `${encodeHTML(this.username)}${ ['x', 's'].includes(this.username.slice(-1)) ? '\'' : '\'s' } Code::Stats Profile` diff --git a/src/cards/TopLanguagesCard.tsx b/src/cards/TopLanguagesCard.tsx index eaaa2da..5dee9f6 100644 --- a/src/cards/TopLanguagesCard.tsx +++ b/src/cards/TopLanguagesCard.tsx @@ -10,6 +10,7 @@ interface TopLanguagesOptions extends CardOptions { card_width?: number layout?: string text_color?: string + title?: string } export default class TopLanguagesCard extends Card { @@ -21,12 +22,10 @@ export default class TopLanguagesCard extends Card { ) { super(options) - this.langs = this.langs .filter((item) => !(options.hide || []).includes(item.name)) .slice(0, options.language_count || 5) - this.height = 45 + (this.langs.length + 1) * 40 this.width = 300 if (options.card_width && !isNaN(options.card_width)) { @@ -34,7 +33,7 @@ export default class TopLanguagesCard extends Card { } const textColor = getColor('text_color', options.text_color, options.theme) - this.title = 'Most Used Languages' + this.title = this.options.title ?? 'Most Used Languages' this.css = CompactTextNode.getCSS(textColor as string) }