diff --git a/src/pages/Tracker/Tracker.tsx b/src/pages/Tracker/Tracker.tsx index d6c11d1..3ef8a43 100644 --- a/src/pages/Tracker/Tracker.tsx +++ b/src/pages/Tracker/Tracker.tsx @@ -27,7 +27,7 @@ import { MenuItem, FormControl, InputLabel, - Typography, + Tooltip, } from "@mui/material"; import { useTheme } from "@mui/material/styles"; import { useGitHubAuth } from "../../hooks/useGitHubAuth"; @@ -49,6 +49,36 @@ interface GitHubItem { html_url: string; } +const LANGUAGE_COLORS: Record = { + JavaScript: "#f1e05a", + TypeScript: "#3178c6", + Python: "#3572A5", + Java: "#b07219", + HTML: "#e34c26", + CSS: "#563d7c", + C: "#555555", + "C++": "#f34b7d", + "C#": "#178600", + PHP: "#4F5D95", + Ruby: "#701516", + Go: "#00ADD8", + Rust: "#dea584", + Kotlin: "#A97BFF", + Swift: "#F05138", +}; + +const getLanguageFromRepo = (repoName: string): string => { + const lowerRepo = repoName.toLowerCase(); + + if (lowerRepo.includes("react") || lowerRepo.includes("js")) return "JavaScript"; + if (lowerRepo.includes("ts") || lowerRepo.includes("typescript")) return "TypeScript"; + if (lowerRepo.includes("python") || lowerRepo.includes("py")) return "Python"; + if (lowerRepo.includes("java")) return "Java"; + if (lowerRepo.includes("html")) return "HTML"; + if (lowerRepo.includes("css")) return "CSS"; + + return "Unknown"; +}; const Home: React.FC = () => { const theme = useTheme(); @@ -449,8 +479,38 @@ const Home: React.FC = () => { - {item.repository_url.split("/").slice(-1)[0]} - + {(() => { + const repoName = item.repository_url.split("/").slice(-1)[0]; + const language = getLanguageFromRepo(repoName); + const color = LANGUAGE_COLORS[language] || "#9ca3af"; + + return ( + + + + {repoName} + + + ); + })()} + {item.pull_request?.merged_at ? "merged" : item.state}