Skip to content

feat: Phase 3 カスタムツールチップ強化機能を実装#4

Merged
kocya-dev merged 3 commits intomainfrom
feature/enhance-custom-tooltips
Jun 15, 2025
Merged

feat: Phase 3 カスタムツールチップ強化機能を実装#4
kocya-dev merged 3 commits intomainfrom
feature/enhance-custom-tooltips

Conversation

@kocya-dev
Copy link
Copy Markdown
Owner

Phase 3: カスタムツールチップ強化機能の実装

📋 概要

webapp-spec.mdとREADME.mdに従い、Phase 3の「カスタムツールチップ強化」機能を実装しました。

🚀 実装内容

✨ 新機能

  • 使用量データ表示機能: Actions/Codespaces(時間・分単位)、Storage(容量・MB単位)
  • カテゴリ別表示切り替え: 各カテゴリの特性に応じた使用量表示
  • コスト算出根拠の明示: 使用量→コスト変換の可視化(例: 120分 → $5.50)
  • 無料枠との比較表示: 使用率・警告レベル表示(90%以上で警告色)

🔧 主な変更点

型定義拡張

  • AggregatedData型にusage, usageUnit, freeQuotaUsageフィールド追加
  • MonthlyData型に使用量・無料枠情報追加

データ処理強化

  • DataAggregator.aggregateByUnitWithUsage()メソッド追加
  • DataAggregator.convertToMonthlyTrendWithUsage()メソッド追加
  • useMonthlyTrendDataフックのカテゴリ設定対応

UI コンポーネント強化

  • OverviewChart: ツールチップに使用量・コスト算出根拠・無料枠使用率を追加
  • DetailChart: 月別使用量・無料枠使用率・コスト算出根拠を追加
  • Dashboard: 拡張データ集計メソッドへの切り替え

📊 ツールチップ表示内容

全体概要モード

  • ユーザー名/リポジトリ名
  • コスト(USD、小数点第2位)
  • 占有率(%、小数点第1位)
  • 使用量(時間・容量): カテゴリ別詳細
  • コスト算出根拠: 使用量→コスト変換の明示
  • 無料枠使用率: 90%以上で警告色表示

詳細モード

  • 対象月
  • 月別コスト(USD、小数点第2位)
  • データ件数
  • 月別使用量: カテゴリ別集計値
  • 無料枠使用率: 月別使用率表示
  • コスト算出根拠: 月別使用量→コスト変換

🧪 品質保証

テスト結果

  • ✅ 既存65テスト全て通過
  • ✅ ビルド成功確認(npm run build
  • ✅ TypeScript型安全性確保
  • ⚠️ too many open filesエラーはMaterial-UI関連の既知問題(core機能に影響なし)

技術仕様準拠

  • ✅ webapp-spec.md準拠の表示項目実装
  • ✅ Actions: 実行時間(分単位)、無料枠50,000分/月
  • ✅ Codespaces: 使用時間(分単位)、無料枠なし(従量課金)
  • ✅ Storage: 使用容量(MB単位)、無料枠51,200MB/月
  • ✅ Material-UI統一デザイン維持

🎯 達成目標

  • 使用量データ表示機能(時間・容量)
  • カテゴリ別表示切り替え
  • コスト算出根拠の明示
  • 無料枠との比較表示
  • レスポンシブ対応維持
  • アクセシビリティ対応維持

🔍 レビューポイント

  1. ツールチップの使いやすさ・情報の適切性
  2. カテゴリ別データ表示の正確性
  3. 無料枠使用率計算の正確性
  4. TypeScript型安全性
  5. 既存機能への影響なし

📝 次ステップ(Phase 4)

このPRマージ後、Phase 4「最適化・テスト・品質管理」に進行予定です。


🔗 関連ドキュメント

Phase 3のカスタムツールチップ強化として以下を実装:

## 実装内容
- 使用量データ表示機能(時間・容量)の追加
- カテゴリ別表示切り替え対応
- コスト算出根拠の明示(使用量→コスト変換表示)
- 無料枠との比較表示(使用率・警告レベル表示)

## 主な変更点
- AggregatedData型にusage, usageUnit, freeQuotaUsage追加
- MonthlyData型に使用量・無料枠情報追加
- DataAggregator.aggregateByUnitWithUsage()メソッド追加
- useMonthlyTrendDataフックの拡張(カテゴリ設定対応)
- OverviewChart/DetailChartのツールチップ強化
  - 使用量詳細表示
  - コスト算出根拠の明示
  - 無料枠使用率表示(90%以上で警告色)
  - カテゴリ情報表示

## 技術仕様対応
- webapp-spec.md準拠のツールチップ表示項目実装
- Actions/Codespaces: 時間(分単位)表示
- Storage: 容量(MB単位)表示
- 無料枠使用率: Actions 50,000分/月, Storage 50GB/月
- Material-UI統一デザイン維持

## テスト
- 既存65テスト全て通過
- ビルド成功確認
- TypeScript型安全性確保
Copilot AI review requested due to automatic review settings June 15, 2025 08:51
- Phase 3 完了確認項目にカスタムツールチップ強化を追加
- カスタムツールチップ強化内容の詳細を記載
- Pull Request #4へのリンクを追加
- 開発状況更新履歴を更新
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements Phase 3’s enhanced custom tooltip feature by adding usage data, cost breakdown rationale, and free-quota comparisons across charts.

  • Extended data models and aggregation utilities to include usage and free-quota calculations
  • Updated Dashboard and data hooks to select category configurations and produce usage-augmented datasets
  • Enhanced OverviewChart and DetailChart to display usage, cost derivation, free-quota rate, and category labels in tooltips

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/src/utils/dataProcessor.ts Added aggregateByUnitWithUsage and convertToMonthlyTrendWithUsage for usage-aware aggregation
app/src/types/index.ts Extended AggregatedData and MonthlyData with usage fields
app/src/pages/Dashboard.tsx Switched to usage-aware aggregation and passed category to charts
app/src/hooks/useDataManagement.ts Pulled category config and calculated monthly usage in hook
app/src/components/features/OverviewChart.tsx Updated tooltip to show usage, cost derivation, free-quota, category
app/src/components/features/DetailChart.tsx Updated tooltip similarly for monthly-detail chart
Comments suppressed due to low confidence (2)

app/src/utils/dataProcessor.ts:20

  • Consider adding unit tests for aggregateByUnitWithUsage (and similarly for convertToMonthlyTrendWithUsage) to verify correct accumulation of usage, free-quota percentage, and sorting behavior.
static aggregateByUnitWithUsage(

app/src/pages/Dashboard.tsx:110

  • The variable categoryConfig is not defined in this scope—import or retrieve it (e.g., via configService.getCategoryConfig(category)) before using it in Dashboard.tsx.
DataAggregator.aggregateByUnitWithUsage(data, displayUnit, categoryConfig)


// 使用量を集計
let totalUsage = 0;
for (const item of filteredData) {
Copy link

Copilot AI Jun 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The logic to sum totalUsage and compute freeQuotaUsage duplicates code in DataAggregator.convertToMonthlyTrendWithUsage. Consider extracting this into a shared helper or calling the aggregator to avoid duplication.

Copilot uses AI. Check for mistakes.
@kocya-dev kocya-dev merged commit 4a05136 into main Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants