Run Prettier

This commit is contained in:
Nathan Chu
2020-09-28 18:11:32 -04:00
parent ef39fbfbe5
commit d1d8fb34e0
4 changed files with 64 additions and 52 deletions
+7 -6
View File
@@ -54,7 +54,7 @@ const renderRepoCard = (repo, options = {}) => {
kr: "보관 됨",
"pt-br": "Arquivada",
},
}
};
const header = show_owner ? nameWithOwner : name;
const langName = (primaryLanguage && primaryLanguage.name) || "Unspecified";
@@ -156,17 +156,18 @@ const renderRepoCard = (repo, options = {}) => {
`);
return card.render(`
${isTemplate
? getBadgeSVG(translations.template[lang] || "Template")
: isArchived
${
isTemplate
? getBadgeSVG(translations.template[lang] || "Template")
: isArchived
? getBadgeSVG(translations.archived[lang] || "Archived")
: ""
}
<text class="description" x="25" y="-5">
${multiLineDescription
.map((line) => `<tspan dy="1.2em" x="25">${encodeHTML(line)}</tspan>`)
.join("")}
.map((line) => `<tspan dy="1.2em" x="25">${encodeHTML(line)}</tspan>`)
.join("")}
</text>
<g transform="translate(0, ${height - 75})">
+12 -9
View File
@@ -147,8 +147,8 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
ja: "に貢献しました",
kr: "에 기여하다",
"pt-br": "Contribuiu para",
}
}
},
};
// Meta data for creating text nodes with createTextNode function
const STATS = {
@@ -160,8 +160,9 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
},
commits: {
icon: icons.commits,
label: `${translations.commits[lang] || "Total Commits"}${include_all_commits ? "" : ` (${new Date().getFullYear()})`
}`,
label: `${translations.commits[lang] || "Total Commits"}${
include_all_commits ? "" : ` (${new Date().getFullYear()})`
}`,
value: totalCommits,
id: "commits",
},
@@ -238,7 +239,9 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
const card = new Card({
customTitle: custom_title,
defaultTitle: translations.title[lang] || `${encodeHTML(name)}'${apostrophe} GitHub Stats`,
defaultTitle:
translations.title[lang] ||
`${encodeHTML(name)}'${apostrophe} GitHub Stats`,
width: 495,
height,
colors: {
@@ -258,10 +261,10 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
<svg x="0" y="0">
${FlexLayout({
items: statItems,
gap: lheight,
direction: "column",
}).join("")}
items: statItems,
gap: lheight,
direction: "column",
}).join("")}
</svg>
`);
};
+11 -10
View File
@@ -11,13 +11,13 @@ const createProgressTextNode = ({ width, color, name, progress }) => {
<text data-testid="lang-name" x="2" y="15" class="lang-name">${name}</text>
<text x="${progressTextX}" y="34" class="lang-name">${progress}%</text>
${createProgressNode({
x: 0,
y: 25,
color,
width: progressWidth,
progress,
progressBarBackgroundColor: "#ddd",
})}
x: 0,
y: 25,
color,
width: progressWidth,
progress,
progressBarBackgroundColor: "#ddd",
})}
`;
};
@@ -88,7 +88,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
kr: "가장 많이 사용되는 언어",
"pt-br": "Línguas Mais Usadas",
},
}
};
// populate langsToHide map for quick lookup
// while filtering out
@@ -158,8 +158,9 @@ const renderTopLanguages = (topLangs, options = {}) => {
finalLayout = `
<mask id="rect-mask">
<rect x="0" y="0" width="${width - 50
}" height="8" fill="white" rx="5" />
<rect x="0" y="0" width="${
width - 50
}" height="8" fill="white" rx="5" />
</mask>
${compactProgressBar}
${createLanguageTextNode({
+34 -27
View File
@@ -24,14 +24,14 @@ const createTextNode = ({
const cardProgress = hideProgress
? null
: createProgressNode({
x: 110,
y: 4,
progress: percent,
color: progressBarColor,
width: 220,
name: label,
progressBarBackgroundColor,
});
x: 110,
y: 4,
progress: percent,
color: progressBarColor,
width: 220,
name: label,
progressBarBackgroundColor,
});
return `
<g class="stagger" style="animation-delay: ${staggerDelay}ms" transform="translate(25, 0)">
@@ -86,7 +86,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
kr: "이번 주 코딩 활동 없음",
"pt-br": "Nenhuma atividade de codificação esta semana",
},
}
};
const lheight = parseInt(line_height, 10);
@@ -101,18 +101,18 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
const statItems = languages
? languages
.filter((language) => language.hours || language.minutes)
.map((language) => {
return createTextNode({
id: language.name,
label: language.name,
value: language.text,
percent: language.percent,
progressBarColor: titleColor,
progressBarBackgroundColor: textColor,
hideProgress: hide_progress,
});
})
.filter((language) => language.hours || language.minutes)
.map((language) => {
return createTextNode({
id: language.name,
label: language.name,
value: language.text,
percent: language.percent,
progressBarColor: titleColor,
progressBarBackgroundColor: textColor,
hideProgress: hide_progress,
});
})
: [];
// Calculate the card height depending on how many items there are
@@ -150,12 +150,19 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
return card.render(`
<svg x="0" y="0" width="100%">
${FlexLayout({
items: statItems.length
? statItems
: [noCodingActivityNode({ color: textColor, text: translations.noCodingActivity[lang] || "No coding activity this week" })],
gap: lheight,
direction: "column",
}).join("")}
items: statItems.length
? statItems
: [
noCodingActivityNode({
color: textColor,
text:
translations.noCodingActivity[lang] ||
"No coding activity this week",
}),
],
gap: lheight,
direction: "column",
}).join("")}
</svg>
`);
};