feat: added repo card hide border option (#488)

* 🚀 Prettier config

* 🚀 hide_border for Repo Card

* fix: wrong total commits (#490)

* chore: run prettier on all files

* chore: lol lets add the trailing commas

Co-authored-by: Anurag Hazra <hazru.anurag@gmail.com>
This commit is contained in:
Bas950
2020-09-24 21:38:14 +05:30
committed by GitHub
co-authored by Anurag Hazra
parent 3c6c142c75
commit 8aea1e3c35
35 changed files with 152 additions and 134 deletions
+3 -2
View File
@@ -21,6 +21,7 @@ const renderRepoCard = (repo, options = {}) => {
forkCount,
} = repo;
const {
hide_border = false,
title_color,
icon_color,
text_color,
@@ -118,7 +119,7 @@ const renderRepoCard = (repo, options = {}) => {
});
card.disableAnimations();
card.setHideBorder(false);
card.setHideBorder(hide_border);
card.setHideTitle(false);
card.setCSS(`
.description { font: 400 13px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${textColor} }
@@ -147,7 +148,7 @@ const renderRepoCard = (repo, options = {}) => {
${svgLanguage}
<g
data-testid="star-fork-group"
data-testid="star-fork-group"
transform="translate(${primaryLanguage ? 155 - shiftText : 25}, 0)"
>
${starAndForkCount}
+2 -2
View File
@@ -124,14 +124,14 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
index,
showIcons: show_icons,
shiftValuePos: !include_all_commits,
})
}),
);
// Calculate the card height depending on how many items there are
// but if rank circle is visible clamp the minimum height to `150`
let height = Math.max(
45 + (statItems.length + 1) * lheight,
hide_rank ? 0 : 150
hide_rank ? 0 : 150,
);
// Conditionally rendered elements
+1 -1
View File
@@ -116,7 +116,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
`
${cssStyles}
.lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${textColor} }
`
`,
);
return card.render(`
+1 -1
View File
@@ -9,7 +9,7 @@ const retryer = async (fetcher, variables, retries = 0) => {
let response = await fetcher(
variables,
process.env[`PAT_${retries + 1}`],
retries
retries,
);
// prettier-ignore
+5 -5
View File
@@ -37,7 +37,7 @@ function kFormatter(num) {
function isValidHexColor(hexColor) {
return new RegExp(
/^([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{4})$/
/^([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{4})$/,
).test(hexColor);
}
@@ -124,19 +124,19 @@ function getCardColors({
// finally if both colors are invalid fallback to default theme
const titleColor = fallbackColor(
title_color || selectedTheme.title_color,
"#" + defaultTheme.title_color
"#" + defaultTheme.title_color,
);
const iconColor = fallbackColor(
icon_color || selectedTheme.icon_color,
"#" + defaultTheme.icon_color
"#" + defaultTheme.icon_color,
);
const textColor = fallbackColor(
text_color || selectedTheme.text_color,
"#" + defaultTheme.text_color
"#" + defaultTheme.text_color,
);
const bgColor = fallbackColor(
bg_color || selectedTheme.bg_color,
"#" + defaultTheme.bg_color
"#" + defaultTheme.bg_color,
);
return { titleColor, iconColor, textColor, bgColor };
+1 -1
View File
@@ -39,7 +39,7 @@ const fetcher = (variables, token) => {
},
{
Authorization: `bearer ${token}`,
}
},
);
};
+3 -3
View File
@@ -45,7 +45,7 @@ const fetcher = (variables, token) => {
},
{
Authorization: `bearer ${token}`,
}
},
);
};
@@ -86,7 +86,7 @@ const totalCommitsFetcher = async (username) => {
async function fetchStats(
username,
count_private = false,
include_all_commits = false
include_all_commits = false,
) {
if (!username) throw Error("Invalid username");
@@ -106,7 +106,7 @@ async function fetchStats(
logger.error(res.data.errors);
throw new CustomError(
res.data.errors[0].message || "Could not fetch user",
CustomError.USER_NOT_FOUND
CustomError.USER_NOT_FOUND,
);
}
+1 -1
View File
@@ -29,7 +29,7 @@ const fetcher = (variables, token) => {
},
{
Authorization: `bearer ${token}`,
}
},
);
};
+1 -1
View File
@@ -2,7 +2,7 @@ const axios = require("axios");
const fetchLast7Days = async ({ username }) => {
const { data } = await axios.get(
`https://wakatime.com/api/v1/users/${username}/stats/last_7_days?is_including_today=true`
`https://wakatime.com/api/v1/users/${username}/stats/last_7_days?is_including_today=true`,
);
return data.data;