feat(ui): forge icon on project page header

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-05 18:30:13 +03:00
parent d46a0e3777
commit abc90c8da0

View File

@@ -54,8 +54,7 @@ export function ProjectPage() {
<>
<Row className="mb-3">
<Col>
<h2>{repo}</h2>
<small className="text-muted">{source}</small>
<h2><img src={forgeIcon(source ?? '')} alt={source} className="forge-icon" style={{ width: 24, height: 24 }} />{repo}</h2>
{langs && <LanguageBar languages={langs} />}
</Col>
</Row>
@@ -90,6 +89,15 @@ export function ProjectPage() {
);
}
function forgeIcon(source: string): string {
switch (source) {
case 'github': return '/github.svg';
case 'gitea': return '/gitea.svg';
case 'hg': return '/mozilla.svg';
default: return '/github.svg';
}
}
function LanguageBar({ languages }: { languages: Record<string, number> }) {
const total = Object.values(languages).reduce((a, b) => a + b, 0);
if (total === 0) return null;