feat(ui): project drill-down route with repo-filtered event timeline
Add repo filter param to /v1/events (SQL COALESCE across payload shapes per source). New /project/:source/* route renders a filtered activity timeline for a single repo. Dashboard cards link to the drill-down page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { Link } from 'react-router-dom';
|
||||
import Col from 'react-bootstrap/Col';
|
||||
import Row from 'react-bootstrap/Row';
|
||||
|
||||
@@ -31,16 +32,9 @@ export function DashPage() {
|
||||
<Row xs={1} md={2} lg={3} className="g-3">
|
||||
{ranked.map((p) => (
|
||||
<Col key={`${p.source}:${p.repo}`}>
|
||||
<Link to={`/project/${p.source}/${p.repo}`} className="text-decoration-none">
|
||||
<div className="project-card p-3">
|
||||
<h5 className="mb-1">
|
||||
<a
|
||||
href={repoUrl(p)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{p.repo}
|
||||
</a>
|
||||
</h5>
|
||||
<h5 className="mb-1">{p.repo}</h5>
|
||||
<small className="text-muted d-block mb-2">{p.source}</small>
|
||||
<div className="d-flex gap-3" style={{ fontSize: '0.8rem' }}>
|
||||
{p.commit_count > 0 && <span>{p.commit_count} commits</span>}
|
||||
@@ -51,6 +45,7 @@ export function DashPage() {
|
||||
{formatRange(p.first_activity, p.last_activity)}
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
@@ -58,21 +53,6 @@ export function DashPage() {
|
||||
);
|
||||
}
|
||||
|
||||
function repoUrl(p: ProjectSummary): string {
|
||||
switch (p.source) {
|
||||
case 'github':
|
||||
return `https://github.com/${p.repo}`;
|
||||
case 'gitea':
|
||||
return `https://${p.host}/${p.repo}`;
|
||||
case 'hg':
|
||||
return `https://${p.host}/${p.repo}`;
|
||||
case 'bugzilla':
|
||||
return `https://${p.host}`;
|
||||
default:
|
||||
return '#';
|
||||
}
|
||||
}
|
||||
|
||||
function formatRange(first: string | null, last: string | null): string {
|
||||
const fmt = (iso: string) =>
|
||||
new Date(iso).toLocaleDateString('en-GB', { month: 'short', year: 'numeric' }).toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user