feat(ui): show private activity count on timeline when no public events
When viewing a date range with zero public activities, the status line now shows the count of private contributions (derived from daily counts which include private repos). Helps explain gaps in the public timeline. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import Col from 'react-bootstrap/Col';
|
|||||||
import Row from 'react-bootstrap/Row';
|
import Row from 'react-bootstrap/Row';
|
||||||
import { VerticalTimeline } from 'react-vertical-timeline-component';
|
import { VerticalTimeline } from 'react-vertical-timeline-component';
|
||||||
|
|
||||||
import { fetchEvents, fetchSources, type Source } from '../api/client';
|
import { fetchDailyCounts, fetchEvents, fetchSources, type Source } from '../api/client';
|
||||||
import { Filters } from '../components/Filters';
|
import { Filters } from '../components/Filters';
|
||||||
import { TimelineEntry } from '../components/TimelineEntry';
|
import { TimelineEntry } from '../components/TimelineEntry';
|
||||||
|
|
||||||
@@ -82,6 +82,19 @@ export function TimelineHome() {
|
|||||||
|
|
||||||
const events = eventsQ.data ?? [];
|
const events = eventsQ.data ?? [];
|
||||||
|
|
||||||
|
const fromStr = new Date(rangeValue[0]).toISOString().slice(0, 10);
|
||||||
|
const toStr = new Date(rangeValue[1]).toISOString().slice(0, 10);
|
||||||
|
const dailyQ = useQuery({
|
||||||
|
queryKey: ['daily-counts', fromStr, toStr],
|
||||||
|
queryFn: () => fetchDailyCounts(fromStr, toStr),
|
||||||
|
staleTime: 5 * 60_000,
|
||||||
|
});
|
||||||
|
const totalCount = useMemo(
|
||||||
|
() => (dailyQ.data ?? []).reduce((sum, d) => sum + d.count, 0),
|
||||||
|
[dailyQ.data],
|
||||||
|
);
|
||||||
|
const privateCount = totalCount - events.length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Filters
|
<Filters
|
||||||
@@ -105,7 +118,7 @@ export function TimelineHome() {
|
|||||||
? 'loading…'
|
? 'loading…'
|
||||||
: eventsQ.isError
|
: eventsQ.isError
|
||||||
? `error: ${(eventsQ.error as Error).message}`
|
? `error: ${(eventsQ.error as Error).message}`
|
||||||
: `showing ${events.length} ${events.length === 1 ? 'activity' : 'activities'}`}
|
: `showing ${events.length} public ${events.length === 1 ? 'activity' : 'activities'}${privateCount > 0 ? `, ${privateCount} private` : ''}`}
|
||||||
</p>
|
</p>
|
||||||
<VerticalTimeline>
|
<VerticalTimeline>
|
||||||
{events.map((item) => (
|
{events.map((item) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user