mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-09-03 12:21:49 +00:00
feat: limit langs shown on wakatime card (#988)
This commit is contained in:
@@ -2,7 +2,7 @@ const Card = require("../common/Card");
|
||||
const I18n = require("../common/I18n");
|
||||
const { getStyles } = require("../getStyles");
|
||||
const { wakatimeCardLocales } = require("../translations");
|
||||
const { getCardColors, FlexLayout } = require("../common/utils");
|
||||
const { clampValue, getCardColors, FlexLayout } = require("../common/utils");
|
||||
const { createProgressNode } = require("../common/createProgressNode");
|
||||
const languageColors = require("../common/languageColors.json");
|
||||
|
||||
@@ -99,6 +99,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
custom_title,
|
||||
locale,
|
||||
layout,
|
||||
langs_count = languages ? languages.length : 0,
|
||||
border_radius
|
||||
} = options;
|
||||
|
||||
@@ -109,6 +110,8 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
|
||||
const lheight = parseInt(line_height, 10);
|
||||
|
||||
langsCount = clampValue(parseInt(langs_count), 1, langs_count);
|
||||
|
||||
// returns theme based colors with proper overrides and defaults
|
||||
const { titleColor, textColor, iconColor, bgColor } = getCardColors({
|
||||
title_color,
|
||||
@@ -121,6 +124,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
const statItems = languages
|
||||
? languages
|
||||
.filter((language) => language.hours || language.minutes)
|
||||
.slice(0, langsCount)
|
||||
.map((language) => {
|
||||
return createTextNode({
|
||||
id: language.name,
|
||||
|
||||
Reference in New Issue
Block a user