feat: limit langs shown on wakatime card (#988)

This commit is contained in:
Florian Bussmann
2021-04-27 00:34:34 +05:30
committed by GitHub
parent 9551f1c5b6
commit 9773d924fb
5 changed files with 10 additions and 1 deletions
+5 -1
View File
@@ -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,