const { kFormatter, encodeHTML, isValidHexColor } = require("../src/utils"); const renderRepoCard = (repo, options = {}) => { const { name, description, primaryLanguage, stargazers, forkCount } = repo; const { title_color, icon_color, text_color, bg_color } = options; const height = 120; const shiftText = primaryLanguage.name.length > 15 ? 0 : 30; let desc = description || "No description provided"; if (desc.length > 55) { desc = `${description.slice(0, 55)}..`; } const titleColor = (isValidHexColor(title_color) && `#${title_color}`) || "#2f80ed"; const iconColor = (isValidHexColor(icon_color) && `#${icon_color}`) || "#586069"; const textColor = (isValidHexColor(text_color) && `#${text_color}`) || "#333"; const bgColor = (isValidHexColor(bg_color) && `#${bg_color}`) || "#FFFEFE"; const totalStars = kFormatter(stargazers.totalCount); const totalForks = kFormatter(forkCount); return ` ${name} ${encodeHTML(desc)} ${ primaryLanguage.name } ${totalStars} ${totalForks} `; }; module.exports = renderRepoCard;