Skip to content

Commit

Permalink
refactor: fix createProgressNode function jsdoc and enable ts-check (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 committed Dec 22, 2023
1 parent 392829f commit 2fa8d0c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/cards/top-languages-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const trimTopLanguages = (topLangs, langs_count, hide) => {
* @param {number} props.width The card width
* @param {string} props.color Color of the programming language.
* @param {string} props.name Name of the programming language.
* @param {string} props.progress Usage of the programming language in percentage.
* @param {number} props.progress Usage of the programming language in percentage.
* @param {number} props.index Index of the programming language.
* @returns {string} Programming language SVG node.
*/
Expand Down Expand Up @@ -329,7 +329,9 @@ const renderNormalLayout = (langs, width, totalLanguageSize) => {
width,
name: lang.name,
color: lang.color || DEFAULT_LANG_COLOR,
progress: ((lang.size / totalLanguageSize) * 100).toFixed(2),
progress: parseFloat(
((lang.size / totalLanguageSize) * 100).toFixed(2),
),
index,
});
}),
Expand Down
2 changes: 1 addition & 1 deletion src/cards/wakatime-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const createLanguageTextNode = ({ langs, y }) => {
* @param {string} args.label The label of the text node item.
* @param {string} args.value The value of the text node item.
* @param {number} args.index The index of the text node item.
* @param {string} args.percent Percentage of the text node item.
* @param {number} args.percent Percentage of the text node item.
* @param {boolean=} args.hideProgress Whether to hide the progress bar.
* @param {string} args.progressBarColor The color of the progress bar.
* @param {string} args.progressBarBackgroundColor The color of the progress bar background.
Expand Down
4 changes: 3 additions & 1 deletion src/common/createProgressNode.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-check

import { clampValue } from "./utils.js";

/**
Expand All @@ -8,7 +10,7 @@ import { clampValue } from "./utils.js";
* @param {number} createProgressNodeParams.y Y-axis position.
* @param {number} createProgressNodeParams.width Width of progress bar.
* @param {string} createProgressNodeParams.color Progress color.
* @param {string} createProgressNodeParams.progress Progress value.
* @param {number} createProgressNodeParams.progress Progress value.
* @param {string} createProgressNodeParams.progressBarBackgroundColor Progress bar bg color.
* @param {number} createProgressNodeParams.delay Delay before animation starts.
* @returns {string} Progress node.
Expand Down

0 comments on commit 2fa8d0c

Please sign in to comment.