feat(ui): link forge icon to repo on project page

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

View File

@@ -54,7 +54,7 @@ export function ProjectPage() {
<>
<Row className="mb-3">
<Col>
<h2><img src={forgeIcon(source ?? '')} alt={source} className="forge-icon" style={{ width: 24, height: 24 }} />{repo}</h2>
<h2><a href={repoUrl(source ?? '', host, repo)} target="_blank" rel="noopener noreferrer"><img src={forgeIcon(source ?? '')} alt={source} className="forge-icon" style={{ width: 24, height: 24 }} /></a>{repo}</h2>
{langs && <LanguageBar languages={langs} />}
</Col>
</Row>
@@ -89,6 +89,15 @@ export function ProjectPage() {
);
}
function repoUrl(source: string, host: string, repo: string): string {
switch (source) {
case 'github': return `https://github.com/${repo}`;
case 'gitea': return `https://${host}/${repo}`;
case 'hg': return `https://${host}/${repo}`;
default: return '#';
}
}
function forgeIcon(source: string): string {
switch (source) {
case 'github': return '/github.svg';