Conversation
There was a problem hiding this comment.
Pull request overview
Adds a “New” badge to shift cards so users can quickly identify newly added/updated shifts, and persists “opened/read” state locally via Hive.
Changes:
- Extend
ShiftCardto optionally render a New badge and notify when a card is opened (ExpansionTile expanded). - Add persistent storage (
openedCardKeysBox) for opened card keys. - Implement New-detection and opened-key filtering in
MyShiftPage, and wire New state intoShiftCard.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| mobile/lib/widgets/shift_card.dart | Adds isNew + onOpened and displays NewBadge next to the task name; triggers callback on expand. |
| mobile/lib/utils/permanent_store.dart | Opens a new Hive box to persist opened-card keys. |
| mobile/lib/pages/my_shift_page.dart | Tracks new/opened card keys, loads persisted opened keys, detects new/updated cards on fetch, and clears/persists state on open. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
未読(新規追加/更新)シフトカードをユーザーが判別できるように、「New」バッジ表示と既読管理(永続化)をモバイル側に追加するPRです。
Changes:
ShiftCardに New バッジ表示(isNew)と開封時コールバック(onOpened)を追加MyShiftPageで New 判定(キャッシュ差分)・開封済み管理・Hive 永続化を実装- Hive に開封済みカードキー保存用の Box を追加
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| mobile/lib/widgets/shift_card.dart | タスク名横に New バッジを表示し、ExpansionTile 展開時に既読化コールバックを発火 |
| mobile/lib/utils/permanent_store.dart | 開封済みカードキー保存用の Hive Box を追加して初期化 |
| mobile/lib/pages/my_shift_page.dart | New キー検出/保持、開封済み管理、Hive 永続化、非同期ロード競合回避を追加 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
📝 WalkthroughWalkthroughThe changes implement a persistent "New" card badge system for shift cards. The system loads previously-opened card keys from Hive storage during initialization, determines which cards are new by comparing fetched card content, passes an Changes
Sequence DiagramsequenceDiagram
participant App as App Init
participant Store as Permanent Store<br/>(Hive)
participant Page as MyShiftPage
participant API as API/Cache
participant UI as ShiftCard Widget
App->>Store: initHive() opens 'openedCardKeys' box
Page->>Store: Load opened card keys from Hive
Store-->>Page: Return user-scoped opened keys
Page->>API: Fetch latest shift card data
API-->>Page: Return fetched cards
Page->>Page: Compute _newCardKeysByDay<br/>by comparing fetched vs. cached<br/>content (task, time, place)
Page->>Page: Filter out already-opened keys<br/>from new card sets
Page->>UI: Render cards with isNew flag<br/>and onOpened callback
UI-->>Page: Display card with badge<br/>if isNew == true
Note over UI,Page: User opens card
UI->>Page: Invoke onOpened callback
Page->>Page: Remove key from<br/>in-memory _newCardKeysByDay
Page->>Store: Persist updated New-key sets<br/>to Hive per day
Store-->>Page: Keys saved
Page->>UI: Re-render without badge
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@mobile/lib/pages/my_shift_page.dart`:
- Around line 396-417: The current key generation in _cardKeyFromShiftCardData
and its use in _buildCardMap collapses multiple distinct ShiftCardData entries
that share day/taskName/startTime/endTime/place; change the key to include a
stable per-card unique identifier from the API (e.g., card.id or card.uniqueId)
if available, otherwise augment the generated key deterministically by appending
an occurrence suffix (e.g., incrementing counter or index for duplicates) when
building the map in _buildCardMap so each card produces a unique map key and
preserves per-card isNew/badge state.
- Around line 264-279: The cache key for shift cards is not namespaced by user
and causes cross-account diffs; include the current user id when loading,
diffing, and writing the cache. Specifically, update calls that use the
'${dayID}_${weatherID}' key (including where you call _loadPersistedNewKeys,
_detectNewOrUpdatedCardKeys inputs if they rely on the cache key, and the final
shiftCardBox.put call) to use a namespaced key like
'${_userID}_${dayID}_${weatherID}' (or equivalent _userID prefix) so both the
baseline load and the put use the same per-user key.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: add656ae-03e6-4707-b812-ffe1d50e045b
📒 Files selected for processing (3)
mobile/lib/pages/my_shift_page.dartmobile/lib/utils/permanent_store.dartmobile/lib/widgets/shift_card.dart
未読シフトへの「New!」バッジ表示の実装
resolve #245
概要
ユーザーが「どのシフトカードが新規追加または更新されたか」を直感的に把握できるように、カード単位でNewバッジを表示する機能の追加。
判定対象は本人のカード情報(タスク名、開始時刻、終了時刻、集合場所)のみ。
画面スクリーンショット等
テスト項目
・初回表示でNewが付く
・カード開封でNewが消える
・変更なし更新でNewが増えない
・対象項目変更時のみNewが付く
・タブ切替後も既読状態が維持される
確認方法
カードの内容が変わるたびに古いキーの削除が行われていることの確認方法
備考
Summary by CodeRabbit
New Features
Performance Improvements