forked from mirrored/github-readme-stats
Compare commits
70
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5ba3238ab | ||
|
|
f4e731ee09 | ||
|
|
6f07b51c00 | ||
|
|
6e0522cdd9 | ||
|
|
4ce744f7b5 | ||
|
|
3565f25c46 | ||
|
|
a5114d12d0 | ||
|
|
20914797b0 | ||
|
|
11cb8dffc1 | ||
|
|
a885425b52 | ||
|
|
017e3ba180 | ||
|
|
03465922b0 | ||
|
|
9829ab990d | ||
|
|
6243c702c3 | ||
|
|
97cef21e4e | ||
|
|
55a3cecd49 | ||
|
|
e245941e5a | ||
|
|
04ed2bdd3f | ||
|
|
c33f3f617a | ||
|
|
589badc483 | ||
|
|
05b611ad58 | ||
|
|
bf0a15f94f | ||
|
|
b8425d36c8 | ||
|
|
866e509d07 | ||
|
|
c1e2858330 | ||
|
|
01f726c316 | ||
|
|
2770161e33 | ||
|
|
b320054e90 | ||
|
|
5675ce77b1 | ||
|
|
27029cd565 | ||
|
|
df42981d34 | ||
|
|
4ecebbca94 | ||
|
|
80e6d0acc5 | ||
|
|
0adcb158f9 | ||
|
|
2cb4861b24 | ||
|
|
3cebd8907b | ||
|
|
42503cf90c | ||
|
|
2466713261 | ||
|
|
9c08efedbf | ||
|
|
af36d0b2e1 | ||
|
|
1689ca6feb | ||
|
|
642d63d4f0 | ||
|
|
2a1d255e45 | ||
|
|
114225e72e | ||
|
|
cc558e4d7c | ||
|
|
6738c6db5f | ||
|
|
ede2574b13 | ||
|
|
c6ca64551e | ||
|
|
5448a611ba | ||
|
|
22aa6887f9 | ||
|
|
ffd927af6d | ||
|
|
f02186908d | ||
|
|
8f63eaeef9 | ||
|
|
70b0d025f8 | ||
|
|
dc95c44c22 | ||
|
|
adbc7a36c9 | ||
|
|
1651db55ec | ||
|
|
e40f214a76 | ||
|
|
88aa6fe30c | ||
|
|
ad731cdfcb | ||
|
|
237942c234 | ||
|
|
d505580a4f | ||
|
|
4dbab9a2a3 | ||
|
|
d8af18e465 | ||
|
|
1af63921b5 | ||
|
|
9ff83e0855 | ||
|
|
6349ec8f32 | ||
|
|
31f2920c09 | ||
|
|
19cf691983 | ||
|
|
36e838da62 |
@@ -1,4 +1,3 @@
|
||||
themes: themes/index.js
|
||||
doc-translation: docs/*
|
||||
card-i18n: src/translations.js
|
||||
documentation: readme.md
|
||||
|
||||
@@ -23,10 +23,6 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: npm
|
||||
|
||||
# Fix the unsafe repo error which was introduced by the CVE-2022-24765 git patches.
|
||||
- name: Fix unsafe repo error
|
||||
run: git config --global --add safe.directory ${{ github.workspace }}
|
||||
|
||||
- name: npm install, generate readme
|
||||
run: |
|
||||
npm ci
|
||||
|
||||
@@ -10,5 +10,3 @@ vercel_token
|
||||
# IDE
|
||||
.vscode
|
||||
*.code-workspace
|
||||
|
||||
.vercel
|
||||
|
||||
@@ -46,8 +46,6 @@ export default async (req, res) => {
|
||||
if (locale && !isLocaleAvailable(locale)) {
|
||||
return res.send(renderError("Something went wrong", "Language not found"));
|
||||
}
|
||||
|
||||
theme = theme.replace(/-/g, "_")
|
||||
|
||||
try {
|
||||
const stats = await fetchStats(
|
||||
|
||||
@@ -35,8 +35,6 @@ export default async (req, res) => {
|
||||
if (locale && !isLocaleAvailable(locale)) {
|
||||
return res.send(renderError("Something went wrong", "Language not found"));
|
||||
}
|
||||
|
||||
theme = theme.replace(/-/g, "_")
|
||||
|
||||
try {
|
||||
const repoData = await fetchRepo(username, repo);
|
||||
|
||||
@@ -41,8 +41,6 @@ export default async (req, res) => {
|
||||
if (locale && !isLocaleAvailable(locale)) {
|
||||
return res.send(renderError("Something went wrong", "Locale not found"));
|
||||
}
|
||||
|
||||
theme = theme.replace(/-/g, "_")
|
||||
|
||||
try {
|
||||
const topLangs = await fetchTopLanguages(
|
||||
|
||||
@@ -38,8 +38,6 @@ export default async (req, res) => {
|
||||
if (locale && !isLocaleAvailable(locale)) {
|
||||
return res.send(renderError("Something went wrong", "Language not found"));
|
||||
}
|
||||
|
||||
theme = theme.replace(/-/g, "_")
|
||||
|
||||
try {
|
||||
const stats = await fetchWakatimeStats({ username, api_domain, range });
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
import statsCard from "./api/index.js";
|
||||
import repoCard from "./api/pin.js";
|
||||
import langCard from "./api/top-langs.js";
|
||||
import wakatimeCard from "./api/wakatime.js";
|
||||
import express from "express";
|
||||
import dotenv from "dotenv";
|
||||
|
||||
dotenv.config();
|
||||
const app = express();
|
||||
app.listen(process.env.port || 9000);
|
||||
|
||||
app.get("/", statsCard);
|
||||
app.get("/pin", repoCard);
|
||||
app.get("/top-langs", langCard);
|
||||
app.get("/wakatime", wakatimeCard);
|
||||
@@ -92,9 +92,7 @@ Visit <https://indiafightscorona.giveindia.org> and make a small donation to hel
|
||||
- [Repo Card Exclusive Options](#repo-card-exclusive-options)
|
||||
- [Language Card Exclusive Options](#language-card-exclusive-options)
|
||||
- [Wakatime Card Exclusive Option](#wakatime-card-exclusive-options)
|
||||
- [Deploy Yourself](#deploy-on-your-own)
|
||||
- [On Vercel](#on-vercel)
|
||||
- [On other platforms](#on-other-platforms)
|
||||
- [Deploy Yourself](#deploy-on-your-own-vercel-instance)
|
||||
- [Keep your fork up to date](#keep-your-fork-up-to-date)
|
||||
|
||||
# GitHub Stats Card
|
||||
@@ -135,7 +133,7 @@ You can add the count of all your private contributions to the total commits cou
|
||||
|
||||
### Showing icons
|
||||
|
||||
To enable icons, you can pass `&show_icons=true` in the query param, like so:
|
||||
To enable icons, you can pass `show_icons=true` in the query param, like so:
|
||||
|
||||
```md
|
||||

|
||||
@@ -511,9 +509,7 @@ By default, GitHub does not lay out the cards side by side. To do that, you can
|
||||
</a>
|
||||
```
|
||||
|
||||
## Deploy on your own
|
||||
|
||||
### On Vercel
|
||||
## Deploy on your own Vercel instance
|
||||
|
||||
#### :film_projector: [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
@@ -550,23 +546,6 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
|
||||
|
||||
</details>
|
||||
|
||||
### On other platforms
|
||||
|
||||
> **Warning**
|
||||
> This way of using GRS is not officially supported and was added to cater to some particular use cases where Vercel could not be used (e.g. #2341). The support for this method, therefore, is limited.
|
||||
|
||||
<details>
|
||||
<summary><b>:hammer_and_wrench: Step-by-step guide for deploying on other platforms</b></summary>
|
||||
|
||||
1. Fork or clone this repo as per your needs
|
||||
2. Add `express` to the dependencies section of `package.json`
|
||||
https://github.com/anuraghazra/github-readme-stats/blob/ba7c2f8b55eac8452e479c8bd38b044d204d0424/package.json#L54-L61
|
||||
3. Run `npm i` if needed (initial setup)
|
||||
4. Run `node express.js` to start the server, or set the entry point to `express.js` in `package.json` if you're deploying on a managed service
|
||||
https://github.com/anuraghazra/github-readme-stats/blob/ba7c2f8b55eac8452e479c8bd38b044d204d0424/package.json#L11
|
||||
5. You're done 🎉
|
||||
</details>
|
||||
|
||||
### Keep your fork up to date
|
||||
|
||||
You can keep your fork, and thus your private Vercel instance up to date with the upstream using GitHubs' [Sync Fork button](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork). You can also use the [pull](https://github.com/wei/pull) package created by [@wei](https://github.com/wei) to automate this process.
|
||||
|
||||
@@ -298,13 +298,12 @@ const themeNameAlreadyExists = (name) => {
|
||||
return themes[name] !== undefined;
|
||||
};
|
||||
|
||||
const DRY_RUN = process.env.DRY_RUN === "true" || false;
|
||||
|
||||
/**
|
||||
* Main function.
|
||||
*/
|
||||
export const run = async (prNumber) => {
|
||||
try {
|
||||
const dryRun = process.env.DRY_RUN === "true" || false;
|
||||
debug("Retrieve action information from context...");
|
||||
debug(`Context: ${inspect(github.context)}`);
|
||||
let commentBody = `
|
||||
@@ -514,7 +513,7 @@ export const run = async (prNumber) => {
|
||||
// Create or update theme-preview comment.
|
||||
debug("Create or update theme-preview comment...");
|
||||
let comment_url;
|
||||
if (!DRY_RUN) {
|
||||
if (!dryRun) {
|
||||
comment_url = await upsertComment(octokit, {
|
||||
comment_id: comment?.id,
|
||||
issue_number: pullRequestId,
|
||||
@@ -536,7 +535,7 @@ export const run = async (prNumber) => {
|
||||
const reviewReason = themesValid
|
||||
? undefined
|
||||
: INVALID_REVIEW_COMMENT(comment_url);
|
||||
if (!DRY_RUN) {
|
||||
if (!dryRun) {
|
||||
await addReview(
|
||||
octokit,
|
||||
pullRequestId,
|
||||
@@ -559,7 +558,7 @@ export const run = async (prNumber) => {
|
||||
}
|
||||
} catch (error) {
|
||||
debug("Set review state to `REQUEST_CHANGES` and add `invalid` label...");
|
||||
if (!DRY_RUN) {
|
||||
if (!dryRun) {
|
||||
await addReview(
|
||||
octokit,
|
||||
pullRequestId,
|
||||
|
||||
+51
-35
@@ -87,16 +87,6 @@ const iconWithLabel = (icon, label, testid) => {
|
||||
* @returns {string} Repository card SVG object.
|
||||
*/
|
||||
const renderRepoCard = (repo, options = {}) => {
|
||||
const {
|
||||
name,
|
||||
nameWithOwner,
|
||||
description,
|
||||
primaryLanguage,
|
||||
isArchived,
|
||||
isTemplate,
|
||||
starCount,
|
||||
forkCount,
|
||||
} = repo;
|
||||
const {
|
||||
hide_border = false,
|
||||
title_color,
|
||||
@@ -109,6 +99,42 @@ const renderRepoCard = (repo, options = {}) => {
|
||||
border_color,
|
||||
locale,
|
||||
} = options;
|
||||
|
||||
const i18n = new I18n({
|
||||
locale,
|
||||
translations: repoCardLocales,
|
||||
});
|
||||
|
||||
const colors = getCardColors({
|
||||
title_color,
|
||||
icon_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
});
|
||||
|
||||
const {
|
||||
name,
|
||||
nameWithOwner,
|
||||
description,
|
||||
primaryLanguage,
|
||||
isArchived,
|
||||
isTemplate,
|
||||
starCount,
|
||||
forkCount,
|
||||
} = repo;
|
||||
|
||||
const highlight = repo.highlight
|
||||
? // @ts-ignore
|
||||
getBadgeSVG(repo.highlight, colors.textColor)
|
||||
: isTemplate
|
||||
? // @ts-ignore
|
||||
getBadgeSVG(i18n.t("repocard.template"), colors.textColor)
|
||||
: isArchived
|
||||
? // @ts-ignore
|
||||
getBadgeSVG(i18n.t("repocard.archived"), colors.textColor)
|
||||
: ""
|
||||
|
||||
const lineHeight = 10;
|
||||
const header = show_owner ? nameWithOwner : name;
|
||||
@@ -125,27 +151,25 @@ const renderRepoCard = (repo, options = {}) => {
|
||||
const height =
|
||||
(descriptionLines > 1 ? 120 : 110) + descriptionLines * lineHeight;
|
||||
|
||||
const i18n = new I18n({
|
||||
locale,
|
||||
translations: repoCardLocales,
|
||||
});
|
||||
|
||||
// returns theme based colors with proper overrides and defaults
|
||||
const colors = getCardColors({
|
||||
title_color,
|
||||
icon_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
});
|
||||
|
||||
const svgLanguage = primaryLanguage
|
||||
? createLanguageNode(langName, langColor)
|
||||
: "";
|
||||
|
||||
const totalStars = kFormatter(starCount);
|
||||
const totalForks = kFormatter(forkCount);
|
||||
|
||||
let totalStars
|
||||
let totalForks
|
||||
if (isNaN(starCount)) {
|
||||
totalStars = starCount;
|
||||
} else {
|
||||
totalStars = kFormatter(starCount);
|
||||
}
|
||||
if (isNaN(forkCount)) {
|
||||
totalForks = forkCount;
|
||||
} else {
|
||||
totalForks = kFormatter(forkCount);
|
||||
}
|
||||
|
||||
const svgStars = iconWithLabel(icons.star, totalStars, "stargazers");
|
||||
const svgForks = iconWithLabel(icons.fork, totalForks, "forkcount");
|
||||
|
||||
@@ -180,15 +204,7 @@ const renderRepoCard = (repo, options = {}) => {
|
||||
`);
|
||||
|
||||
return card.render(`
|
||||
${
|
||||
isTemplate
|
||||
? // @ts-ignore
|
||||
getBadgeSVG(i18n.t("repocard.template"), colors.textColor)
|
||||
: isArchived
|
||||
? // @ts-ignore
|
||||
getBadgeSVG(i18n.t("repocard.archived"), colors.textColor)
|
||||
: ""
|
||||
}
|
||||
${highlight}
|
||||
|
||||
<text class="description" x="25" y="-5">
|
||||
${descriptionSvg}
|
||||
|
||||
+44
-32
@@ -40,7 +40,12 @@ const createTextNode = ({
|
||||
shiftValuePos,
|
||||
bold,
|
||||
}) => {
|
||||
const kValue = kFormatter(value);
|
||||
let kValue
|
||||
if (isNaN(value)) {
|
||||
kValue = value;
|
||||
} else {
|
||||
kValue = kFormatter(value);
|
||||
}
|
||||
const staggerDelay = (index + 3) * 150;
|
||||
|
||||
const labelOffset = showIcons ? `x="25"` : "";
|
||||
@@ -75,15 +80,6 @@ const createTextNode = ({
|
||||
* @returns {string} The stats card SVG object.
|
||||
*/
|
||||
const renderStatsCard = (stats = {}, options = { hide: [] }) => {
|
||||
const {
|
||||
name,
|
||||
totalStars,
|
||||
totalCommits,
|
||||
totalIssues,
|
||||
totalPRs,
|
||||
contributedTo,
|
||||
rank,
|
||||
} = stats;
|
||||
const {
|
||||
hide = [],
|
||||
show_icons = false,
|
||||
@@ -106,6 +102,37 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
|
||||
locale,
|
||||
disable_animations = false,
|
||||
} = options;
|
||||
|
||||
const name = stats.name || "GitHub User"
|
||||
|
||||
const apostrophe = ["x", "s"].includes(name.slice(-1).toLocaleLowerCase())
|
||||
? ""
|
||||
: "s";
|
||||
|
||||
const i18n = new I18n({
|
||||
locale,
|
||||
translations: statCardLocales({ name, apostrophe }),
|
||||
});
|
||||
|
||||
const {
|
||||
totalStars = "2018",
|
||||
totalCommits = "29019",
|
||||
totalIssues = "203",
|
||||
totalPRs = "127",
|
||||
contributedTo = "232",
|
||||
rank = {
|
||||
level: "S",
|
||||
score: 10
|
||||
},
|
||||
starsTitle = i18n.t("statcard.totalstars"),
|
||||
commitsTitle = `${i18n.t("statcard.commits")}${
|
||||
include_all_commits ? "" : ` (${new Date().getFullYear()})`
|
||||
}`,
|
||||
issuesTitle = i18n.t("statcard.issues"),
|
||||
PRsTitle = i18n.t("statcard.prs"),
|
||||
contribsTitle = i18n.t("statcard.contribs") + " (last year)",
|
||||
title = i18n.t("statcard.title"),
|
||||
} = stats;
|
||||
|
||||
const lheight = parseInt(String(line_height), 10);
|
||||
|
||||
@@ -121,45 +148,35 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
|
||||
theme,
|
||||
});
|
||||
|
||||
const apostrophe = ["x", "s"].includes(name.slice(-1).toLocaleLowerCase())
|
||||
? ""
|
||||
: "s";
|
||||
const i18n = new I18n({
|
||||
locale,
|
||||
translations: statCardLocales({ name, apostrophe }),
|
||||
});
|
||||
|
||||
// Meta data for creating text nodes with createTextNode function
|
||||
const STATS = {
|
||||
stars: {
|
||||
icon: icons.star,
|
||||
label: i18n.t("statcard.totalstars"),
|
||||
label: starsTitle,
|
||||
value: totalStars,
|
||||
id: "stars",
|
||||
},
|
||||
commits: {
|
||||
icon: icons.commits,
|
||||
label: `${i18n.t("statcard.commits")}${
|
||||
include_all_commits ? "" : ` (${new Date().getFullYear()})`
|
||||
}`,
|
||||
label: commitsTitle,
|
||||
value: totalCommits,
|
||||
id: "commits",
|
||||
},
|
||||
prs: {
|
||||
icon: icons.prs,
|
||||
label: i18n.t("statcard.prs"),
|
||||
label: PRsTitle,
|
||||
value: totalPRs,
|
||||
id: "prs",
|
||||
},
|
||||
issues: {
|
||||
icon: icons.issues,
|
||||
label: i18n.t("statcard.issues"),
|
||||
label: issuesTitle,
|
||||
value: totalIssues,
|
||||
id: "issues",
|
||||
},
|
||||
contribs: {
|
||||
icon: icons.contribs,
|
||||
label: i18n.t("statcard.contribs") + " (last year)",
|
||||
label: contribsTitle,
|
||||
value: contributedTo,
|
||||
id: "contribs",
|
||||
},
|
||||
@@ -215,7 +232,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
|
||||
});
|
||||
|
||||
const calculateTextWidth = () => {
|
||||
return measureText(custom_title ? custom_title : i18n.t("statcard.title"));
|
||||
return measureText(custom_title ? custom_title : title);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -241,7 +258,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
|
||||
|
||||
const card = new Card({
|
||||
customTitle: custom_title,
|
||||
defaultTitle: i18n.t("statcard.title"),
|
||||
defaultTitle: title,
|
||||
width,
|
||||
height,
|
||||
border_radius,
|
||||
@@ -306,11 +323,6 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
|
||||
const labels = Object.keys(STATS)
|
||||
.filter((key) => !hide.includes(key))
|
||||
.map((key) => {
|
||||
if (key === "commits") {
|
||||
return `${i18n.t("statcard.commits")} ${
|
||||
include_all_commits ? "" : `in ${new Date().getFullYear()}`
|
||||
} : ${totalStars}`;
|
||||
}
|
||||
return `${STATS[key].label}: ${STATS[key].value}`;
|
||||
})
|
||||
.join(", ");
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
import { langCardLocales } from "../translations.js";
|
||||
|
||||
const DEFAULT_CARD_WIDTH = 300;
|
||||
const MIN_CARD_WIDTH = 280;
|
||||
const MIN_CARD_WIDTH = 230;
|
||||
const DEFAULT_LANGS_COUNT = 5;
|
||||
const DEFAULT_LANG_COLOR = "#858585";
|
||||
const CARD_PADDING = 25;
|
||||
@@ -47,6 +47,7 @@ const getLongestLang = (arr) =>
|
||||
* @param {number} props.index Index of the programming language.
|
||||
* @returns {string} Programming language SVG node.
|
||||
*/
|
||||
|
||||
const createProgressTextNode = ({ width, color, name, progress, index }) => {
|
||||
const staggerDelay = (index + 3) * 150;
|
||||
const paddingRight = 95;
|
||||
@@ -56,7 +57,7 @@ const createProgressTextNode = ({ width, color, name, progress, index }) => {
|
||||
return `
|
||||
<g class="stagger" style="animation-delay: ${staggerDelay}ms">
|
||||
<text data-testid="lang-name" x="2" y="15" class="lang-name">${name}</text>
|
||||
<text x="${progressTextX}" y="34" class="lang-name">${progress}%</text>
|
||||
<text x="${progressTextX}" y="34" class="lang-name">${text || `${progress}%`}</text>
|
||||
${createProgressNode({
|
||||
x: 0,
|
||||
y: 25,
|
||||
@@ -89,7 +90,7 @@ const createCompactLangNode = ({ lang, totalSize, hideProgress, index }) => {
|
||||
<g class="stagger" style="animation-delay: ${staggerDelay}ms">
|
||||
<circle cx="5" cy="6" r="5" fill="${color}" />
|
||||
<text data-testid="lang-name" x="15" y="10" class='lang-name'>
|
||||
${lang.name} ${hideProgress ? "" : percentage + "%"}
|
||||
${lang.name} ${hideProgress ? "" : (lang.text || `${percentage}%`)}
|
||||
</text>
|
||||
</g>
|
||||
`;
|
||||
@@ -126,7 +127,7 @@ const createLanguageTextNode = ({ langs, totalSize, hideProgress }) => {
|
||||
|
||||
const percent = ((longestLang.size / totalSize) * 100).toFixed(2);
|
||||
const minGap = 150;
|
||||
const maxGap = 20 + measureText(`${longestLang.name} ${percent}%`, 11);
|
||||
const maxGap = 20 + measureText(`${longestLang.name} ${longestLang.text || `${percent}%`}`, 11);
|
||||
return flexLayout({
|
||||
items: layouts,
|
||||
gap: maxGap < minGap ? minGap : maxGap,
|
||||
@@ -149,6 +150,7 @@ const renderNormalLayout = (langs, width, totalLanguageSize) => {
|
||||
name: lang.name,
|
||||
color: lang.color || DEFAULT_LANG_COLOR,
|
||||
progress: ((lang.size / totalLanguageSize) * 100).toFixed(2),
|
||||
text: lang.text,
|
||||
index,
|
||||
});
|
||||
}),
|
||||
@@ -278,6 +280,12 @@ const useLanguages = (topLangs, hide, langs_count) => {
|
||||
* @returns {string} Language card SVG object.
|
||||
*/
|
||||
const renderTopLanguages = (topLangs, options = {}) => {
|
||||
const locale = options.locale
|
||||
const i18n = new I18n({
|
||||
locale,
|
||||
translations: langCardLocales,
|
||||
});
|
||||
|
||||
const {
|
||||
hide_title = false,
|
||||
hide_border,
|
||||
@@ -290,18 +298,13 @@ const renderTopLanguages = (topLangs, options = {}) => {
|
||||
theme,
|
||||
layout,
|
||||
custom_title,
|
||||
locale,
|
||||
langs_count = DEFAULT_LANGS_COUNT,
|
||||
border_radius,
|
||||
border_color,
|
||||
title = i18n.t("langcard.title"),
|
||||
disable_animations,
|
||||
} = options;
|
||||
|
||||
const i18n = new I18n({
|
||||
locale,
|
||||
translations: langCardLocales,
|
||||
});
|
||||
|
||||
const { langs, totalLanguageSize } = useLanguages(
|
||||
topLangs,
|
||||
hide,
|
||||
@@ -317,6 +320,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
|
||||
|
||||
let finalLayout = "";
|
||||
if (layout === "compact" || hide_progress == true) {
|
||||
width = width + 50; // padding
|
||||
height =
|
||||
calculateCompactLayoutHeight(langs.length) + (hide_progress ? -25 : 0);
|
||||
|
||||
@@ -341,7 +345,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
|
||||
|
||||
const card = new Card({
|
||||
customTitle: custom_title,
|
||||
defaultTitle: i18n.t("langcard.title"),
|
||||
defaultTitle: title,
|
||||
width,
|
||||
height,
|
||||
border_radius,
|
||||
|
||||
@@ -118,7 +118,6 @@ const createTextNode = ({
|
||||
// @ts-ignore
|
||||
name: label,
|
||||
progressBarBackgroundColor,
|
||||
delay: staggerDelay + 300,
|
||||
});
|
||||
|
||||
return `
|
||||
@@ -277,12 +276,11 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
} else {
|
||||
finalLayout = flexLayout({
|
||||
items: filteredLanguages.length
|
||||
? filteredLanguages.map((language, index) => {
|
||||
? filteredLanguages.map((language) => {
|
||||
return createTextNode({
|
||||
id: language.name,
|
||||
label: language.name,
|
||||
value: language.text,
|
||||
index: index,
|
||||
percent: language.percent,
|
||||
// @ts-ignore
|
||||
progressBarColor: titleColor,
|
||||
@@ -323,29 +321,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
card.setCSS(
|
||||
`
|
||||
${cssStyles}
|
||||
@keyframes slideInAnimation {
|
||||
from {
|
||||
width: 0;
|
||||
}
|
||||
to {
|
||||
width: calc(100%-100px);
|
||||
}
|
||||
}
|
||||
@keyframes growWidthAnimation {
|
||||
from {
|
||||
width: 0;
|
||||
}
|
||||
to {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${textColor} }
|
||||
#rect-mask rect{
|
||||
animation: slideInAnimation 1s ease-in-out forwards;
|
||||
}
|
||||
.lang-progress{
|
||||
animation: growWidthAnimation 0.6s ease-in-out forwards;
|
||||
}
|
||||
`,
|
||||
);
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@
|
||||
"Ceylon": "#dfa535",
|
||||
"Chapel": "#8dc63f",
|
||||
"ChucK": "#3f8000",
|
||||
"Circom": "#707575",
|
||||
"Cirru": "#ccccff",
|
||||
"Clarion": "#db901e",
|
||||
"Clarity": "#5546ff",
|
||||
@@ -117,7 +116,6 @@
|
||||
"DirectX 3D File": "#aace60",
|
||||
"Dockerfile": "#384d54",
|
||||
"Dogescript": "#cca760",
|
||||
"Dotenv": "#e5d559",
|
||||
"Dylan": "#6c616e",
|
||||
"E": "#ccce35",
|
||||
"ECL": "#8a1267",
|
||||
@@ -151,7 +149,7 @@
|
||||
"Forth": "#341708",
|
||||
"Fortran": "#4d41b1",
|
||||
"Fortran Free Form": "#4d41b1",
|
||||
"FreeBasic": "#141AC9",
|
||||
"FreeBasic": "#867db1",
|
||||
"FreeMarker": "#0050b2",
|
||||
"Frege": "#00cafe",
|
||||
"Futhark": "#5f021f",
|
||||
@@ -184,7 +182,6 @@
|
||||
"Go": "#00ADD8",
|
||||
"Go Checksums": "#00ADD8",
|
||||
"Go Module": "#00ADD8",
|
||||
"Godot Resource": "#355570",
|
||||
"Golo": "#88562A",
|
||||
"Gosu": "#82937f",
|
||||
"Grace": "#615f8b",
|
||||
@@ -195,7 +192,6 @@
|
||||
"Groovy": "#4298b8",
|
||||
"Groovy Server Pages": "#4298b8",
|
||||
"HAProxy": "#106da9",
|
||||
"HCL": "#844FBA",
|
||||
"HLSL": "#aace60",
|
||||
"HOCON": "#9ff8ee",
|
||||
"HTML": "#e34c26",
|
||||
@@ -229,7 +225,6 @@
|
||||
"Isabelle ROOT": "#FEFE00",
|
||||
"J": "#9EEDFF",
|
||||
"JAR Manifest": "#b07219",
|
||||
"JCL": "#d90e09",
|
||||
"JFlex": "#DBCA00",
|
||||
"JSON": "#292929",
|
||||
"JSON with Comments": "#292929",
|
||||
@@ -252,11 +247,9 @@
|
||||
"Jsonnet": "#0064bd",
|
||||
"Julia": "#a270ba",
|
||||
"Jupyter Notebook": "#DA5B0B",
|
||||
"Just": "#384d54",
|
||||
"KRL": "#28430A",
|
||||
"Kaitai Struct": "#773b37",
|
||||
"KakouneScript": "#6f8042",
|
||||
"KerboScript": "#41adf0",
|
||||
"KiCad Layout": "#2f4aab",
|
||||
"KiCad Legacy Layout": "#2f4aab",
|
||||
"KiCad Schematic": "#2f4aab",
|
||||
@@ -369,7 +362,6 @@
|
||||
"PicoLisp": "#6067af",
|
||||
"PigLatin": "#fcd7de",
|
||||
"Pike": "#005390",
|
||||
"PlantUML": "#fbbd16",
|
||||
"PogoScript": "#d80074",
|
||||
"Polar": "#ae81ff",
|
||||
"Portugol": "#f8bd00",
|
||||
@@ -387,7 +379,6 @@
|
||||
"Puppet": "#302B6D",
|
||||
"PureBasic": "#5a6986",
|
||||
"PureScript": "#1D222D",
|
||||
"Pyret": "#ee1e10",
|
||||
"Python": "#3572A5",
|
||||
"Python console": "#3572A5",
|
||||
"Python traceback": "#3572A5",
|
||||
@@ -540,6 +531,7 @@
|
||||
"fish": "#4aae47",
|
||||
"hoon": "#00b171",
|
||||
"jq": "#c7254e",
|
||||
"just": "#384d54",
|
||||
"kvlang": "#1da6e0",
|
||||
"mIRC Script": "#3d57c3",
|
||||
"mcfunction": "#E22837",
|
||||
|
||||
@@ -69,29 +69,7 @@ exports[`Test Render Wakatime Card should render correctly with compact layout 1
|
||||
}
|
||||
|
||||
|
||||
@keyframes slideInAnimation {
|
||||
from {
|
||||
width: 0;
|
||||
}
|
||||
to {
|
||||
width: calc(100%-100px);
|
||||
}
|
||||
}
|
||||
@keyframes growWidthAnimation {
|
||||
from {
|
||||
width: 0;
|
||||
}
|
||||
to {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: #434d58 }
|
||||
#rect-mask rect{
|
||||
animation: slideInAnimation 1s ease-in-out forwards;
|
||||
}
|
||||
.lang-progress{
|
||||
animation: growWidthAnimation 0.6s ease-in-out forwards;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -249,29 +227,7 @@ exports[`Test Render Wakatime Card should render correctly with compact layout w
|
||||
}
|
||||
|
||||
|
||||
@keyframes slideInAnimation {
|
||||
from {
|
||||
width: 0;
|
||||
}
|
||||
to {
|
||||
width: calc(100%-100px);
|
||||
}
|
||||
}
|
||||
@keyframes growWidthAnimation {
|
||||
from {
|
||||
width: 0;
|
||||
}
|
||||
to {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: #434d58 }
|
||||
#rect-mask rect{
|
||||
animation: slideInAnimation 1s ease-in-out forwards;
|
||||
}
|
||||
.lang-progress{
|
||||
animation: growWidthAnimation 0.6s ease-in-out forwards;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,14 +15,14 @@ const REPO = "curly-fiesta";
|
||||
const USER = "catelinemnemosyne";
|
||||
const STATS_DATA = {
|
||||
name: "Cateline Mnemosyne",
|
||||
totalPRs: 2,
|
||||
totalCommits: 8,
|
||||
totalPRs: 1,
|
||||
totalCommits: 7,
|
||||
totalIssues: 1,
|
||||
totalStars: 1,
|
||||
contributedTo: 1,
|
||||
rank: {
|
||||
level: "A+",
|
||||
score: 50.88831151384285,
|
||||
score: 50.893750297869225,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ describe("Test renderTopLanguages", () => {
|
||||
);
|
||||
expect(queryAllByTestId(document.body, "lang-progress")[0]).toHaveAttribute(
|
||||
"width",
|
||||
"100",
|
||||
"120",
|
||||
);
|
||||
|
||||
expect(queryAllByTestId(document.body, "lang-name")[1]).toHaveTextContent(
|
||||
@@ -224,7 +224,7 @@ describe("Test renderTopLanguages", () => {
|
||||
);
|
||||
expect(queryAllByTestId(document.body, "lang-progress")[1]).toHaveAttribute(
|
||||
"width",
|
||||
"100",
|
||||
"120",
|
||||
);
|
||||
|
||||
expect(queryAllByTestId(document.body, "lang-name")[2]).toHaveTextContent(
|
||||
@@ -232,7 +232,7 @@ describe("Test renderTopLanguages", () => {
|
||||
);
|
||||
expect(queryAllByTestId(document.body, "lang-progress")[2]).toHaveAttribute(
|
||||
"width",
|
||||
"50",
|
||||
"60",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -374,13 +374,6 @@ export const themes = {
|
||||
border_color: "170F0C",
|
||||
bg_color: "170F0C",
|
||||
},
|
||||
one_dark_pro: {
|
||||
title_color: "61AFEF",
|
||||
text_color: "E5C06E",
|
||||
icon_color: "C678DD",
|
||||
border_color: "3B4048",
|
||||
bg_color: "23272E",
|
||||
},
|
||||
rose: {
|
||||
title_color: "8d192b",
|
||||
text_color: "862931",
|
||||
@@ -388,13 +381,6 @@ export const themes = {
|
||||
border_color: "e9d8d4",
|
||||
bg_color: "e9d8d4",
|
||||
},
|
||||
holi_theme: {
|
||||
title_color: "5FABEE",
|
||||
text_color: "D6E7FF",
|
||||
icon_color: "5FABEE",
|
||||
border_color: "85A4C0",
|
||||
bg_color: "030314",
|
||||
},
|
||||
};
|
||||
|
||||
export default themes;
|
||||
|
||||
Reference in New Issue
Block a user