Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9773d92

Browse files
feat: limit langs shown on wakatime card (anuraghazra#988)
1 parent9551f1c commit9773d92

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

‎api/wakatime.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module.exports = async (req, res) => {
2525
custom_title,
2626
locale,
2727
layout,
28+
langs_count,
2829
api_domain,
2930
range,
3031
border_radius,
@@ -66,6 +67,7 @@ module.exports = async (req, res) => {
6667
border_radius,
6768
locale:locale ?locale.toLowerCase() :null,
6869
layout,
70+
langs_count,
6971
}),
7072
);
7173
}catch(err){

‎docs/readme_de.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Du kannst mehrere, mit Kommas separierte, Werte in der bg_color Option angeben,
174174
-`hide_progress` - Verbirgt die Fortschrittanzeige und Prozentzahl_(boolean)_
175175
-`custom_title` - Legt einen benutzerdefinierten Titel fest
176176
-`layout` - Wechselt zwischen zwei verschiedenen Layouts:`default` &`compact`
177+
-`langs_count` - Begrenzt die Anzahl der angezeigten Sprachen auf der Karte
177178
-`api_domain` - Legt eine benutzerdefinierte API Domain fest, z.B. für[Hakatime](https://github.com/mujx/hakatime) oder[Wakapi](https://github.com/muety/wakapi)
178179
-`range` – Fragt eine eine Zeitspanne an, als die standardmäßig in WakaTime hinterlegte, z.B.`last_7_days`. Siehe[WakaTime API Dokumentation](https://wakatime.com/developers#stats).
179180

‎docs/readme_es.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ Puedes pasar mútliples valores separados por coma en la opción `bg_color` para
192192
-`hide_progress` - Oculta la barra de progreso y el porcentaje_(booleano)_
193193
-`custom_title` - Establece un título personalizado
194194
-`layout` - Cambia entre los dos diseños disponibles`default` &`compact`
195+
-`langs_count` - Limita el número de idiomas que aparecen en el mapa
195196
-`api_domain` - Establece un dominio de API personalizado para la tarjeta
196197

197198
---

‎readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ You can provide multiple comma-separated values in bg_color option to render a g
211211
-`hide_progress` - Hides the progress bar and percentage_(boolean)_
212212
-`custom_title` - Sets a custom title for the card
213213
-`layout` - Switch between two available layouts`default` &`compact`
214+
-`langs_count` - Limit number of languages on the card, defaults to all reported langauges
214215
-`api_domain` - Set a custom API domain for the card, e.g. to use services like[Hakatime](https://github.com/mujx/hakatime) or[Wakapi](https://github.com/muety/wakapi)
215216
-`range` – Request a range different from your WakaTime default, e.g.`last_7_days`. See[WakaTime API docs](https://wakatime.com/developers#stats) for list of available options.
216217

‎src/cards/wakatime-card.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const Card = require("../common/Card");
22
constI18n=require("../common/I18n");
33
const{ getStyles}=require("../getStyles");
44
const{ wakatimeCardLocales}=require("../translations");
5-
const{ getCardColors, FlexLayout}=require("../common/utils");
5+
const{clampValue,getCardColors, FlexLayout}=require("../common/utils");
66
const{ createProgressNode}=require("../common/createProgressNode");
77
constlanguageColors=require("../common/languageColors.json");
88

@@ -99,6 +99,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
9999
custom_title,
100100
locale,
101101
layout,
102+
langs_count=languages ?languages.length :0,
102103
border_radius
103104
}=options;
104105

@@ -109,6 +110,8 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
109110

110111
constlheight=parseInt(line_height,10);
111112

113+
langsCount=clampValue(parseInt(langs_count),1,langs_count);
114+
112115
// returns theme based colors with proper overrides and defaults
113116
const{ titleColor, textColor, iconColor, bgColor}=getCardColors({
114117
title_color,
@@ -121,6 +124,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
121124
conststatItems=languages
122125
?languages
123126
.filter((language)=>language.hours||language.minutes)
127+
.slice(0,langsCount)
124128
.map((language)=>{
125129
returncreateTextNode({
126130
id:language.name,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp