diff --git a/readme.md b/readme.md index 5c6ef2ef..175908aa 100644 --- a/readme.md +++ b/readme.md @@ -623,6 +623,7 @@ You can customize the appearance and behavior of the WakaTime stats card using t | --- | --- | --- | --- | | `hide` | Hides the languages specified from the card. | string (comma-separated values) | `null` | | `hide_title` | Hides the title of your card. | boolean | `false` | +| `card_width` | Sets the card's width manually. | number | `495` | | `line_height` | Sets the line height between text. | integer | `25` | | `hide_progress` | Hides the progress bar and percentage. | boolean | `false` | | `custom_title` | Sets a custom title for the card. | string | `WakaTime Stats` | diff --git a/src/cards/wakatime.js b/src/cards/wakatime.js index abed0a11..9f1404e0 100644 --- a/src/cards/wakatime.js +++ b/src/cards/wakatime.js @@ -223,10 +223,10 @@ const getStyles = ({ */ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => { let { languages = [] } = stats; - const { + let { hide_title = false, hide_border = false, - card_width = 495, + card_width, hide, line_height = 25, title_color, @@ -245,6 +245,10 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => { disable_animations, } = options; + if (isNaN(card_width)) { + card_width = 495; + } + const shouldHideLangs = Array.isArray(hide) && hide.length > 0; if (shouldHideLangs) { const languagesToHide = new Set(hide.map((lang) => lowercaseTrim(lang))); @@ -335,7 +339,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => { y: 25, langs: filteredLanguages, display_format, - card_width: card_width, + card_width, }).join("") : noCodingActivityNode({ // @ts-ignore