feat:매장 운영 업무 스케줄 위젯 추가(#28) - #28
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthrough대시보드 레이아웃 저장이 useEffect 기반으로 바뀌었고, 위젯 렌더링에 workspaceId 컨텍스트가 추가됐다. RecentResources는 workspaceId로 필터링되며, work-schedule 템플릿 위젯과 WorkScheduleSummary가 새로 등록됐다. Changes대시보드 레이아웃 저장 및 위젯 컨텍스트 전달
WorkScheduleSummary 위젯 추가
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant DashboardView
participant DashboardGrid
participant WidgetCatalog
participant RecentResources
participant WorkScheduleSummary
DashboardView->>DashboardGrid: workspaceId prop 전달
DashboardGrid->>WidgetCatalog: widget.render(size, { workspaceId })
WidgetCatalog->>RecentResources: workspaceId 전달
WidgetCatalog->>WorkScheduleSummary: workspaceId 전달
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
9651e63 to
5e749e7
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/features/dashboard/edit-layout/model/useDashboardLayout.ts`:
- Line 31: The layout-save path in useDashboardLayout currently calls
saveDashboardLayout on every layout change, which can trigger repeated saves
during drag/resize. Update the effect or change handler in useDashboardLayout to
debounce or batch these calls so saveDashboardLayout is invoked only after
changes settle, using the existing layout state and saveDashboardLayout symbol
to keep the behavior centralized.
- Line 38: The `useDashboardLayout` save path is discarding the
`saveDashboardLayout` promise without handling failures, so update the call site
to explicitly catch errors instead of relying on `void`. Use the
`saveDashboardLayout` invocation in `useDashboardLayout` to attach a rejection
handler that logs or otherwise handles the error, keeping the current
fire-and-forget behavior while preventing unhandled rejections when the real DB
implementation is added.
In
`@src/widgets/store-operation/dashboard-work-schedule/ui/WorkScheduleSummary.tsx`:
- Around line 69-86: The weekday summary in WorkScheduleSummary is aggregating
only the mock initial schedule, so it never reflects real day-to-day variation.
Update the logic around createInitialWorkSchedule, countSchedulesByWeekday, and
the workingShifts/primaryShift calculations to use actual schedule state or
injected data instead of the fixed mock defaultShift pattern; if this view is
meant to stay mock-only, replace this section with a simpler non-comparative
display that does not imply real weekday differences.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 33fbf92f-c6ee-4062-8bdf-afdcb7ce5abe
📒 Files selected for processing (9)
src/features/dashboard/edit-layout/model/useDashboardLayout.tssrc/shared/dashboard/model/widget.types.tssrc/views/dashboard/config/template-widgets.tssrc/views/dashboard/config/widget-catalog.tsxsrc/views/dashboard/ui/DashboardGrid.tsxsrc/views/dashboard/ui/DashboardView.tsxsrc/widgets/store-operation/dashboard-recent-resources/ui/RecentResources.tsxsrc/widgets/store-operation/dashboard-work-schedule/index.tssrc/widgets/store-operation/dashboard-work-schedule/ui/WorkScheduleSummary.tsx
| const [editMode, setEditMode] = useState(false); | ||
| const didMountRef = useRef(false); | ||
|
|
||
| // TODO: DB 연동 — 변경 저장 (드래그 중 잦은 호출은 debounce 예정) |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win
TODO: 드래그 중 저장 호출 debounce 필요
주석에 명시된 대로, layout이 변경될 때마다(드래그/리사이즈 stop 등) saveDashboardLayout이 호출되어 동일 세션에서 반복 호출이 발생할 수 있습니다. 실제 DB 연동 시 debounce나 트랜지션 배칭을 적용하는 것을 권장합니다. 원하시면 debounce 유틸리티 추가를 도와드릴까요?
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/features/dashboard/edit-layout/model/useDashboardLayout.ts` at line 31,
The layout-save path in useDashboardLayout currently calls saveDashboardLayout
on every layout change, which can trigger repeated saves during drag/resize.
Update the effect or change handler in useDashboardLayout to debounce or batch
these calls so saveDashboardLayout is invoked only after changes settle, using
the existing layout state and saveDashboardLayout symbol to keep the behavior
centralized.
| return; | ||
| } | ||
|
|
||
| void saveDashboardLayout(workspaceId, pageType, { layout }); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
saveDashboardLayout 프로미스 에러 처리 누락
void saveDashboardLayout(...)는 프로미스를 버릴 뿐 실패를 처리하지 않습니다. 현재는 no-op 스텁이라 문제가 없지만, TODO에 명시된 실제 DB 연동이 구현되면 예외 발생 시 unhandled rejection으로 조용히 실패합니다.
🛡️ 제안: catch로 에러 처리 추가
- void saveDashboardLayout(workspaceId, pageType, { layout });
+ saveDashboardLayout(workspaceId, pageType, { layout }).catch((error) => {
+ console.error('Failed to save dashboard layout', error);
+ });📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| void saveDashboardLayout(workspaceId, pageType, { layout }); | |
| saveDashboardLayout(workspaceId, pageType, { layout }).catch((error) => { | |
| console.error('Failed to save dashboard layout', error); | |
| }); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/features/dashboard/edit-layout/model/useDashboardLayout.ts` at line 38,
The `useDashboardLayout` save path is discarding the `saveDashboardLayout`
promise without handling failures, so update the call site to explicitly catch
errors instead of relying on `void`. Use the `saveDashboardLayout` invocation in
`useDashboardLayout` to attach a rejection handler that logs or otherwise
handles the error, keeping the current fire-and-forget behavior while preventing
unhandled rejections when the real DB implementation is added.
| const members = mockWorkspaceMembers.filter((member) => member.workspaceId === workspaceId); | ||
| const schedule = createInitialWorkSchedule({ | ||
| workspaceId, | ||
| members, | ||
| config: mockWorkScheduleConfig, | ||
| }); | ||
| const today = getTodayWeekday(); | ||
| const todayCounts = countSchedulesByWeekday({ | ||
| schedule, | ||
| config: mockWorkScheduleConfig, | ||
| weekday: today, | ||
| }); | ||
| const workingShifts = mockWorkScheduleConfig.shifts.filter((shift) => !shift.isOff); | ||
| const totalWorkingMembers = workingShifts.reduce( | ||
| (total, shift) => total + (todayCounts[shift.id] ?? 0), | ||
| 0, | ||
| ); | ||
| const primaryShift = workingShifts.find((shift) => (todayCounts[shift.id] ?? 0) > 0); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# create-initial-work-schedule.ts의 실제 용도(placeholder 여부) 및 다른 소비처 확인
rg -n "createInitialWorkSchedule" -A5 -B5 --type=tsRepository: TeampleRun/syncly
Length of output: 155
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg 'WorkScheduleSummary\.tsx|work-schedule|createInitialWorkSchedule|countSchedulesByWeekday|mockWorkScheduleConfig|mockWorkspaceMembers'
echo
echo "== usages =="
rg -n "createInitialWorkSchedule|countSchedulesByWeekday|mockWorkScheduleConfig|mockWorkspaceMembers|getTodayWeekday" src
echo
echo "== likely file outline =="
fd -a "WorkScheduleSummary.tsx|work-schedule.*ts" srcRepository: TeampleRun/syncly
Length of output: 5914
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== create-initial-work-schedule =="
cat -n src/entities/work-schedule/lib/create-initial-work-schedule.ts
echo
echo "== count-schedules-by-weekday =="
cat -n src/entities/work-schedule/lib/count-schedules-by-weekday.ts
echo
echo "== WorkScheduleSummary (relevant range) =="
sed -n '1,240p' src/widgets/store-operation/dashboard-work-schedule/ui/WorkScheduleSummary.tsx
echo
echo "== WorkScheduleView =="
cat -n src/views/store-operation/work-schedule/ui/WorkScheduleView.tsxRepository: TeampleRun/syncly
Length of output: 9812
src/widgets/store-operation/dashboard-work-schedule/ui/WorkScheduleSummary.tsx:69-86, 158-182 — 요일별 근무 요약은 목업 초기 스케줄만 집계합니다. createInitialWorkSchedule가 모든 멤버에게 모든 요일의 같은 defaultShift.id를 넣어서, 이 그리드는 실제 요일별 차이 대신 항상 비슷한 값만 보여줍니다. 실제 주간 비교가 필요하면 스케줄 상태를 주입하거나, 목업이면 이 섹션을 다른 표현으로 바꾸는 편이 낫습니다.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/widgets/store-operation/dashboard-work-schedule/ui/WorkScheduleSummary.tsx`
around lines 69 - 86, The weekday summary in WorkScheduleSummary is aggregating
only the mock initial schedule, so it never reflects real day-to-day variation.
Update the logic around createInitialWorkSchedule, countSchedulesByWeekday, and
the workingShifts/primaryShift calculations to use actual schedule state or
injected data instead of the fixed mock defaultShift pattern; if this view is
meant to stay mock-only, replace this section with a simpler non-comparative
display that does not imply real weekday differences.
feat:매장 운영 업무 스케줄 위젯 추가(#28)
Pull Request
작업 내용
workspaceId컨텍스트를 전달해 위젯별 데이터 스코프를 맞췄습니다.작업 결과
store-operation대시보드 편집 모드의 위젯 추가 목록에업무 스케줄이 표시됩니다.workspaceId기준으로 필터링되어 다른 워크스페이스 자료가 섞이지 않습니다.변경 사항
Added
dashboard-work-schedule위젯 추가workspaceId추가Changed
store-operation템플릿의 추가 가능 위젯 목록에 업무 스케줄 추가Fixed
useEffect로 이동해 state updater 내부 부수효과 제거실행화면
테스트
검증 명령:
npm run lintnpm run typechecknpm run buildgit diff --check리뷰 체크리스트
feature/*->develop, 배포 시develop또는release/*->main)Type/#issue-number/description형식을 따릅니다.console.log, 주석, 임시 코드를 제거했습니다.리뷰 요청사항
workspaceId로 확장한 방향이 이후 공지/자료/스케줄 DB 연동에도 적절한지 봐주세요.관련 이슈
Closes #28
Summary by CodeRabbit