diff --git a/src/activity-data.ts b/src/activity-data.ts index 0fb7d52..ea406d8 100644 --- a/src/activity-data.ts +++ b/src/activity-data.ts @@ -20,94 +20,58 @@ export type PeriodOption = { buckets: readonly ActivityBucket[] } +const ACTIVITY_BUCKET_METADATA = [ + { + kind: 'pull-request', + label: 'Pull request', + shortLabel: 'PR', + color: '#007da5', + radius: 1.2, + description: '변경 제안과 병합 준비 흐름', + }, + { + kind: 'issue', + label: '이슈', + shortLabel: '이슈', + color: '#4f8f32', + radius: 1.8, + description: '논의 중인 문제와 개선 요청', + }, + { + kind: 'commit', + label: '커밋', + shortLabel: '커밋', + color: '#c4457c', + radius: 2.45, + description: '저장소에 반영된 코드 변화', + }, + { + kind: 'review', + label: '리뷰', + shortLabel: '리뷰', + color: '#b77900', + radius: 3, + description: '변경을 검토하고 판단한 기록', + }, +] as const satisfies readonly Omit[] + +const createPeriodBuckets = (counts: Record): readonly ActivityBucket[] => + ACTIVITY_BUCKET_METADATA.map((bucket) => ({ ...bucket, count: counts[bucket.kind] })) + export const PERIOD_OPTIONS = [ { mode: 'week', buttonLabel: '이번 주', metricLabel: '주간', insight: '커밋 밀도가 높고, 이슈 대응 궤도가 두 번째로 활발합니다.', - buckets: [ - { - kind: 'pull-request', - label: 'Pull request', - shortLabel: 'PR', - count: 18, - color: '#007da5', - radius: 1.2, - description: '변경 제안과 병합 준비 흐름', - }, - { - kind: 'issue', - label: '이슈', - shortLabel: '이슈', - count: 31, - color: '#4f8f32', - radius: 1.8, - description: '논의 중인 문제와 개선 요청', - }, - { - kind: 'commit', - label: '커밋', - shortLabel: '커밋', - count: 74, - color: '#c4457c', - radius: 2.45, - description: '저장소에 반영된 코드 변화', - }, - { - kind: 'review', - label: '리뷰', - shortLabel: '리뷰', - count: 12, - color: '#b77900', - radius: 3, - description: '변경을 검토하고 판단한 기록', - }, - ], + buckets: createPeriodBuckets({ 'pull-request': 18, issue: 31, commit: 74, review: 12 }), }, { mode: 'month', buttonLabel: '이번 달', metricLabel: '월간', insight: '이슈와 커밋 궤도가 넓게 쌓여 장기 흐름 비교에 적합합니다.', - buckets: [ - { - kind: 'pull-request', - label: 'Pull request', - shortLabel: 'PR', - count: 52, - color: '#007da5', - radius: 1.2, - description: '변경 제안과 병합 준비 흐름', - }, - { - kind: 'issue', - label: '이슈', - shortLabel: '이슈', - count: 86, - color: '#4f8f32', - radius: 1.8, - description: '논의 중인 문제와 개선 요청', - }, - { - kind: 'commit', - label: '커밋', - shortLabel: '커밋', - count: 164, - color: '#c4457c', - radius: 2.45, - description: '저장소에 반영된 코드 변화', - }, - { - kind: 'review', - label: '리뷰', - shortLabel: '리뷰', - count: 41, - color: '#b77900', - radius: 3, - description: '변경을 검토하고 판단한 기록', - }, - ], + buckets: createPeriodBuckets({ 'pull-request': 52, issue: 86, commit: 164, review: 41 }), }, ] as const satisfies readonly PeriodOption[]