SessionScreen Props 계약
모바일 일지 탭 화면 UiSessionScreen(src/react/ui/mobile/screens/SessionScreen.tsx)의 입력 계약이다. props 타입은 src/react/types/mobileSessionPresentation.ts 의 SessionScreenProps, 세션 카드 값은 SessionPresentationInput(src/react/types/sessionPresentation.ts)이다. 화면은 표시만 맡고, 데이터 적재 · 저장 · 서버 호출은 바인딩(features/calendar/MobileCalendarBinding.tsx, 친구 일지 features/social/MobileFriendScopeBinding.tsx, 그룹 멤버 세션 features/group/MobileGroupBinding.tsx)이 맡는다.
화면 구성
- 기본 뷰는 월 달력(
SessionCalendar)이다. 월 헤더(오늘 단추 +‹ ›월 이동)와 날짜 칸 격자로 이뤄진다. photos가 있으면 범위 탭(UiScopeTabs— 오운완 · 운동일지 · 앨범)이 생기고, 오운완 탭은PhotoMonthScroll, 앨범 탭은JournalPhotoGrid를 그린다.photos가 없으면 운동일지(달력)만 그린다.- 날짜 칸을 누르면
onOpenDay(date)가 불린다. 바인딩은 탭 화면 스택에 하루 상세 항목을 push 한다(push("daySummary", { date, origin, ownerId, presentation: "journal" }), 화면 스택 계약). - 월 제목(
calendarMonthStats)을 누르면onOpenMonthReport(monthKey)("YYYY-MM")가 불린다. 바인딩은 현재 탭 스택에homeReport(periodUnit: "month")를 push 한다. 미공급이면 아무 일도 없다. - 추가 단추(
journalHeaderAdd)는 날짜를 고르는 대화상자(SessionAddDialog)를 열고, 대화상자는onCreatePlan(date)·onAddPastRecord(date)를 부른다. selectedSession이 있고sessionAsOverlay가 아니면 화면은 달력 대신 세션 상세(UiSessionDetail)를 그린다.sessionAsOverlay가 참이면 화면은 세션 상세를 그리지 않고, 세션 상세는 탭 화면 스택의 세션 항목이 그린다.
Props
type SessionScreenProps = {
// 달력 자료
today: string;
visibleMonth: CalendarMonth;
selectedDate?: string;
previewByDate?: CalendarPreviewByDate<SessionPresentationInput> | null; // 날짜 → 미리보기(개수 · 칩 · 카드)
monthSummary?: { exactAvailable?: boolean; completedDayCount?: number; volume?: number } | null;
monthStatus?: DataPublicationStatus; // 달 자료의 공개 상태
onRetryMonth?: () => void;
pending?: boolean; // 달력 골격을 그린다
photos?: HomeProfilePhotos | null; // 사진 탭 자료
// 세션 상세
selectedSession?: SessionPresentationInput | null;
sessionAsOverlay?: boolean;
highlightExerciseId?: ExerciseId | null;
isWorkoutActive?: boolean;
profile?: SessionProfileView | null;
ownerName?: string | null; // 다른 사람의 일지 · 세션일 때 소유자 이름
onReturn?: () => void;
returnLabel?: string;
onBack?: () => void; // 조회 문맥의 뒤로가기(친구 일지)
// 이동
onSelectDate?: (date: string) => void;
onOpenDay?: (date: string) => void;
onChangeMonth?: (month: CalendarMonth) => void;
onGoToday?: () => void;
onCloseSession?: () => void;
onOpenMonthReport?: (monthKey: string) => void;
onRefresh?: () => unknown; // 당겨서 새로 고침
// 기록 명령
onCreatePlan?: (date: string) => void;
onAddPastRecord?: (date: string) => void;
onEditPlan?: (session: SessionPresentationInput) => void;
onStartWorkout?: (session: SessionPresentationInput) => void;
onDeleteSession?: (session: SessionPresentationInput) => void | Promise<void>;
onDownloadImage?: (session: SessionPresentationInput) => void;
};동작 규칙
- 고치기: 화면에는 세션을 직접 고치는 콜백이 없다. 계획 고치기(
onEditPlan)와 기록 고치기(세션 상세의onEditRecord)는 운동 작성 엔진(계약)을 열고, 엔진의 저장 요청이api.save_workout_session_v1로 운동 기록 표(workout.workout_session과 그 아래 레벨)를 쓴다. - 지우기:
onDeleteSession은 세션 객체 전체를 받는다.source("sessions"완료 기록 /"planned_sessions"계획)는 화면 수준의 구분값이고, 두 종류 모두workout.workout_session의 행이다. 바인딩은features/session/sessionDeleteCommand.ts(createSessionDeleteCommand)로 쓰기 리포지토리의deleteSavedWorkout을 부르고, 아웃박스(outbox)에만 있는 기록은dropPendingUpload로 지운다. 화면은 삭제 확인 대화상자와 진행 상태를 지역 상태로 들고(useUiTask—session.calendar.delete), 실패하면 "운동 기록을 삭제하지 못했어요. 다시 시도해 주세요." 를 보인다. 바인딩의 콜백은 실제 실패에서 Promise 를 reject 한다. - 조회 전용 문맥(친구 · 그룹): 조회 문맥은 수정 계열 콜백(
onEditPlan·onDeleteSession·onStartWorkout·onCreatePlan·onAddPastRecord)을 공급하지 않아 편집 진입점을 닫는다. 세션의readOnly값은 화면이 읽지 않는다. 다른 사람의 세션은 앱 전역 세션 상태를 쓰지 않고 전용 스택 항목(friendSession·groupSession)으로 연다. - 하루 상세 자료: 하루 상세가 합계 · 종목 줄을 그리려면 세션이 세트까지 채워져 있어야 한다. 목록 서버 함수가 세션 요약만 주는 문맥(친구 일지 달력)은 바인딩이 그날 세션 상세를 따로 받아 채우고, 도착 전에는
_calendarDetailPending: true로 골격을 그린다. - 화면은 서버 클라이언트 · 리포지토리 API 를 import 하지 않는다. 실제 자료 변경은 콜백으로만 일어난다.
화면 마커
data-ba-hook: mobileSessionCalendarView · mobileSessionCalendarGrid · mobileSessionTodayButton · mobileSessionPrevMonthButton · mobileSessionNextMonthButton · calendarMonthStats · journalHeaderAdd · journalAddDateCal · addPlanButton · addPastRecordButton. data-ba-action: calendar.today · calendar.prevMonth · calendar.nextMonth · calendar.plan.add.