Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 32 additions & 25 deletions src/cards/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,36 @@ const RANK_CARD_DEFAULT_WIDTH = 450;
const RANK_ONLY_CARD_MIN_WIDTH = 290;
const RANK_ONLY_CARD_DEFAULT_WIDTH = 290;

/**
* Long locales that need more space for text. Keep sorted alphabetically.
*
* @type {(keyof typeof wakatimeCardLocales["wakatimecard.title"])[]}
*/
const LONG_LOCALES = [
"az",
"bg",
"cs",
"de",
"es",
"fil",
"fr",
"id",
"ml",
"my",
"nl",
"pl",
"pt-br",
"pt-pt",
"ru",
"sr",
"sr-latn",
"sw",
"ta",
"uk-ua",
"uz",
"zh-tw",
];

/**
* Create a stats card text item.
*
Expand Down Expand Up @@ -374,31 +404,8 @@ const renderStatsCard = (stats, options = {}) => {
id: "contribs",
};

const longLocales = [
"az",
"bg",
"cs",
"de",
"es",
"fil",
"fr",
"id",
"ml",
"my",
"nl",
"pl",
"pt-br",
"pt-pt",
"ru",
"sr",
"sr-latn",
"sw",
"ta",
"uk-ua",
"uz",
"zh-tw",
];
const isLongLocale = locale ? longLocales.includes(locale) : false;
// @ts-ignore
const isLongLocale = locale ? LONG_LOCALES.includes(locale) : false;

// filter out hidden stats defined by user & create the text nodes
const statItems = Object.keys(STATS)
Expand Down
Loading