CommandMate
CommandMate copied to clipboard
feat(repositories): サイドバーに/repositoriesリンク追加+管理ページのAdd/Sync Allボタンを上部に配置
背景 / 要望
リポジトリ管理(/repositories)への導線と、管理ページのボタン配置を改善したい。
- サイドバー上部に /repositories への遷移リンクを追加したい。
- /repositories ページの 「Add Repository」「Sync All」ボタンをページ上部に表示したい(現状はリストの下=ページ下部)。
現状(develop で確認)
① サイドバーに /repositories リンクが無い
- サイドバーのヘッダー
src/components/layout/Sidebar.tsx:422-434: 左に「Branches」、右にViewModeToggle/SortSelector/SyncButton。/repositories へのリンクは無い。 /repositoriesルートは存在(src/app/repositories/page.tsx)。- 既存導線は PC 上部 Header の「Repos」リンクのみ(
src/components/layout/Header.tsx)。
② Add/Sync ボタンがページ下部にある
- ボタン定義:
src/components/repository/RepositoryManager.tsx:193-208- 「+ Add Repository」:
onClickで追加フォーム表示(!showAddForm時のみ表示)。 - 「Sync All」:
POST /api/repositories/sync→ 一覧リフレッシュ(常時表示、同期中は disabled)。
- 「+ Add Repository」:
- ページ構造(
src/app/repositories/page.tsx)がタイトル → RepositoryList → RepositoryManager(ボタン+フォーム)のため、ボタンがリストの下に表示される。 - ラベルはハードコード(i18nなし)。
RepositoryManagerは /repositories でのみ使用。
対応方針
① サイドバーヘッダーに /repositories リンク追加
Sidebar.tsx:422-434の右ボタン群(SyncButtonの隣)に、next/linkの<Link href="/repositories">+ アイコン(lucide-react のDatabase等)を追加。- ダークテーマのホバー/フォーカス様式(
text-gray-300 hover:text-white hover:bg-gray-700 focus:ring-2 focus:ring-cyan-500等)を踏襲。title/aria-label="Repositories"を付与。
② Add/Sync ボタンをページ上部へ
RepositoryManagerのボタン行を**「Repositories」タイトルと同じ行(または直下)=ページ上部**に配置。- 実装: ボタンの state/handler(
showAddForm/handleSyncRepositories)をページ側に持ち上げる、もしくはRepositoryManagerを「上部のアクションボタン領域」と「フォーム/リスト領域」に分離してヘッダーに配置。 - 追加フォームは従来どおりボタン押下で展開(上部ボタン直下に表示)。
受け入れ条件
- [ ] サイドバー上部(ヘッダー)から /repositories へワンクリックで遷移できる(PC)。
- [ ] リンクのアイコン/ホバー/フォーカスがサイドバーの既存様式に揃っている。
- [ ] /repositories ページで「Add Repository」「Sync All」がページ上部(タイトル付近)に表示される。
- [ ] Add フォーム展開・Sync All(同期→一覧リフレッシュ)の既存動作が維持される。
- [ ] モバイル表示が崩れない(ボタンの折り返し等)。
- [ ] lint / tsc / test:unit / build 通過。関連テスト(
RepositoryManager.test.tsx)を更新。
影響ファイル
- ①:
src/components/layout/Sidebar.tsx - ②:
src/app/repositories/page.tsx,src/components/repository/RepositoryManager.tsx,tests/unit/components/repository/RepositoryManager.test.tsx
補足
- 要望文の「Add Repositories」「sync all」は実コードでは「+ Add Repository」「Sync All」表記。文言統一が必要なら別途検討。