@tipp/ui 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/dist/app/index.js +17 -17
  2. package/dist/app/platform/edit-coaching-time.js +17 -17
  3. package/dist/app/platform/edit-service-type.js +17 -17
  4. package/dist/app/platform/goal-manage-card-edit.js +17 -17
  5. package/dist/app/platform/on-offline-radio-card.js +17 -17
  6. package/dist/app/platform/reservation-card.js +17 -17
  7. package/dist/app/platform/session-card.js +17 -17
  8. package/dist/app/roleplay/chart/session-chart.cjs +351 -0
  9. package/dist/app/roleplay/chart/session-chart.cjs.map +1 -0
  10. package/dist/app/roleplay/chart/session-chart.d.cts +16 -0
  11. package/dist/app/roleplay/chart/session-chart.d.ts +16 -0
  12. package/dist/app/roleplay/chart/session-chart.js +14 -0
  13. package/dist/app/roleplay/chart/session-chart.js.map +1 -0
  14. package/dist/app/roleplay/index.cjs +5706 -0
  15. package/dist/app/roleplay/index.cjs.map +1 -0
  16. package/dist/app/roleplay/index.d.cts +4 -0
  17. package/dist/app/roleplay/index.d.ts +4 -0
  18. package/dist/app/roleplay/index.js +182 -0
  19. package/dist/app/roleplay/index.js.map +1 -0
  20. package/dist/app/roleplay/parts/analysis-section.cjs +2178 -0
  21. package/dist/app/roleplay/parts/analysis-section.cjs.map +1 -0
  22. package/dist/app/roleplay/parts/analysis-section.d.cts +17 -0
  23. package/dist/app/roleplay/parts/analysis-section.d.ts +17 -0
  24. package/dist/app/roleplay/parts/analysis-section.js +97 -0
  25. package/dist/app/roleplay/parts/analysis-section.js.map +1 -0
  26. package/dist/app/roleplay/parts/coaching-panel.cjs +2191 -0
  27. package/dist/app/roleplay/parts/coaching-panel.cjs.map +1 -0
  28. package/dist/app/roleplay/parts/coaching-panel.d.cts +8 -0
  29. package/dist/app/roleplay/parts/coaching-panel.d.ts +8 -0
  30. package/dist/app/roleplay/parts/coaching-panel.js +95 -0
  31. package/dist/app/roleplay/parts/coaching-panel.js.map +1 -0
  32. package/dist/app/roleplay/parts/content.cjs +4683 -0
  33. package/dist/app/roleplay/parts/content.cjs.map +1 -0
  34. package/dist/app/roleplay/parts/content.d.cts +15 -0
  35. package/dist/app/roleplay/parts/content.d.ts +15 -0
  36. package/dist/app/roleplay/parts/content.js +174 -0
  37. package/dist/app/roleplay/parts/content.js.map +1 -0
  38. package/dist/app/roleplay/parts/header.cjs +2300 -0
  39. package/dist/app/roleplay/parts/header.cjs.map +1 -0
  40. package/dist/app/roleplay/parts/header.d.cts +13 -0
  41. package/dist/app/roleplay/parts/header.d.ts +13 -0
  42. package/dist/app/roleplay/parts/header.js +96 -0
  43. package/dist/app/roleplay/parts/header.js.map +1 -0
  44. package/dist/app/roleplay/parts/score-summary.cjs +2276 -0
  45. package/dist/app/roleplay/parts/score-summary.cjs.map +1 -0
  46. package/dist/app/roleplay/parts/score-summary.d.cts +12 -0
  47. package/dist/app/roleplay/parts/score-summary.d.ts +12 -0
  48. package/dist/app/roleplay/parts/score-summary.js +96 -0
  49. package/dist/app/roleplay/parts/score-summary.js.map +1 -0
  50. package/dist/app/roleplay/parts/score-trend-section.cjs +3686 -0
  51. package/dist/app/roleplay/parts/score-trend-section.cjs.map +1 -0
  52. package/dist/app/roleplay/parts/score-trend-section.d.cts +14 -0
  53. package/dist/app/roleplay/parts/score-trend-section.d.ts +14 -0
  54. package/dist/app/roleplay/parts/score-trend-section.js +168 -0
  55. package/dist/app/roleplay/parts/score-trend-section.js.map +1 -0
  56. package/dist/app/roleplay/parts/script-transcript.cjs +2288 -0
  57. package/dist/app/roleplay/parts/script-transcript.cjs.map +1 -0
  58. package/dist/app/roleplay/parts/script-transcript.d.cts +15 -0
  59. package/dist/app/roleplay/parts/script-transcript.d.ts +15 -0
  60. package/dist/app/roleplay/parts/script-transcript.js +96 -0
  61. package/dist/app/roleplay/parts/script-transcript.js.map +1 -0
  62. package/dist/app/roleplay/parts/section-nav.cjs +2433 -0
  63. package/dist/app/roleplay/parts/section-nav.cjs.map +1 -0
  64. package/dist/app/roleplay/parts/section-nav.d.cts +15 -0
  65. package/dist/app/roleplay/parts/section-nav.d.ts +15 -0
  66. package/dist/app/roleplay/parts/section-nav.js +96 -0
  67. package/dist/app/roleplay/parts/section-nav.js.map +1 -0
  68. package/dist/app/roleplay/parts/session-replay-dialog.cjs +2598 -0
  69. package/dist/app/roleplay/parts/session-replay-dialog.cjs.map +1 -0
  70. package/dist/app/roleplay/parts/session-replay-dialog.d.cts +14 -0
  71. package/dist/app/roleplay/parts/session-replay-dialog.d.ts +14 -0
  72. package/dist/app/roleplay/parts/session-replay-dialog.js +97 -0
  73. package/dist/app/roleplay/parts/session-replay-dialog.js.map +1 -0
  74. package/dist/app/roleplay/parts/step-detail.cjs +2311 -0
  75. package/dist/app/roleplay/parts/step-detail.cjs.map +1 -0
  76. package/dist/app/roleplay/parts/step-detail.d.cts +9 -0
  77. package/dist/app/roleplay/parts/step-detail.d.ts +9 -0
  78. package/dist/app/roleplay/parts/step-detail.js +96 -0
  79. package/dist/app/roleplay/parts/step-detail.js.map +1 -0
  80. package/dist/app/roleplay/parts/step-radar.cjs +463 -0
  81. package/dist/app/roleplay/parts/step-radar.cjs.map +1 -0
  82. package/dist/app/roleplay/parts/step-radar.d.cts +8 -0
  83. package/dist/app/roleplay/parts/step-radar.d.ts +8 -0
  84. package/dist/app/roleplay/parts/step-radar.js +14 -0
  85. package/dist/app/roleplay/parts/step-radar.js.map +1 -0
  86. package/dist/app/roleplay/parts/step-summary.cjs +2651 -0
  87. package/dist/app/roleplay/parts/step-summary.cjs.map +1 -0
  88. package/dist/app/roleplay/parts/step-summary.d.cts +8 -0
  89. package/dist/app/roleplay/parts/step-summary.d.ts +8 -0
  90. package/dist/app/roleplay/parts/step-summary.js +101 -0
  91. package/dist/app/roleplay/parts/step-summary.js.map +1 -0
  92. package/dist/app/roleplay/rp-session-detail.cjs +5703 -0
  93. package/dist/app/roleplay/rp-session-detail.cjs.map +1 -0
  94. package/dist/app/roleplay/rp-session-detail.d.cts +17 -0
  95. package/dist/app/roleplay/rp-session-detail.d.ts +17 -0
  96. package/dist/app/roleplay/rp-session-detail.js +179 -0
  97. package/dist/app/roleplay/rp-session-detail.js.map +1 -0
  98. package/dist/app/roleplay/types.cjs +19 -0
  99. package/dist/app/roleplay/types.cjs.map +1 -0
  100. package/dist/app/roleplay/types.d.cts +42 -0
  101. package/dist/app/roleplay/types.d.ts +42 -0
  102. package/dist/app/roleplay/types.js +2 -0
  103. package/dist/app/roleplay/types.js.map +1 -0
  104. package/dist/app/roleplay/utils/report-parse.cjs +285 -0
  105. package/dist/app/roleplay/utils/report-parse.cjs.map +1 -0
  106. package/dist/app/roleplay/utils/report-parse.d.cts +57 -0
  107. package/dist/app/roleplay/utils/report-parse.d.ts +57 -0
  108. package/dist/app/roleplay/utils/report-parse.js +8 -0
  109. package/dist/app/roleplay/utils/report-parse.js.map +1 -0
  110. package/dist/app/roleplay/utils/report-parse.test.cjs +491 -0
  111. package/dist/app/roleplay/utils/report-parse.test.cjs.map +1 -0
  112. package/dist/app/roleplay/utils/report-parse.test.d.cts +2 -0
  113. package/dist/app/roleplay/utils/report-parse.test.d.ts +2 -0
  114. package/dist/app/roleplay/utils/report-parse.test.js +237 -0
  115. package/dist/app/roleplay/utils/report-parse.test.js.map +1 -0
  116. package/dist/app/roleplay/utils/session-utils.cjs +204 -0
  117. package/dist/app/roleplay/utils/session-utils.cjs.map +1 -0
  118. package/dist/app/roleplay/utils/session-utils.d.cts +38 -0
  119. package/dist/app/roleplay/utils/session-utils.d.ts +38 -0
  120. package/dist/app/roleplay/utils/session-utils.js +46 -0
  121. package/dist/app/roleplay/utils/session-utils.js.map +1 -0
  122. package/dist/chunk-2TOASXPK.js +131 -0
  123. package/dist/chunk-2TOASXPK.js.map +1 -0
  124. package/dist/chunk-3UGBMKSQ.js +166 -0
  125. package/dist/chunk-3UGBMKSQ.js.map +1 -0
  126. package/dist/chunk-4YAA25AV.js +161 -0
  127. package/dist/chunk-4YAA25AV.js.map +1 -0
  128. package/dist/chunk-5QIT4URV.js +87 -0
  129. package/dist/chunk-5QIT4URV.js.map +1 -0
  130. package/dist/chunk-6YIKOYBQ.js +185 -0
  131. package/dist/chunk-6YIKOYBQ.js.map +1 -0
  132. package/dist/chunk-7MXY3D3Z.js +84 -0
  133. package/dist/chunk-7MXY3D3Z.js.map +1 -0
  134. package/dist/chunk-EBFQFOUQ.js +138 -0
  135. package/dist/chunk-EBFQFOUQ.js.map +1 -0
  136. package/dist/chunk-EHDUKUML.js +183 -0
  137. package/dist/chunk-EHDUKUML.js.map +1 -0
  138. package/dist/{chunk-NEJCZABQ.js → chunk-FJEDSUGU.js} +7 -7
  139. package/dist/chunk-GA6W62DO.js +101 -0
  140. package/dist/chunk-GA6W62DO.js.map +1 -0
  141. package/dist/chunk-KJPBBBVK.js +142 -0
  142. package/dist/chunk-KJPBBBVK.js.map +1 -0
  143. package/dist/{chunk-TQTCT7DC.js → chunk-LRNO4W2P.js} +5 -5
  144. package/dist/{chunk-6DWUGXSY.js → chunk-N242VJOP.js} +2 -2
  145. package/dist/chunk-NKW6BO5R.js +264 -0
  146. package/dist/chunk-NKW6BO5R.js.map +1 -0
  147. package/dist/{chunk-R5UDNKV2.js → chunk-O332K3SW.js} +2 -2
  148. package/dist/chunk-OUP3VFXG.js +1 -0
  149. package/dist/chunk-OUP3VFXG.js.map +1 -0
  150. package/dist/chunk-QMAINJ4G.js +190 -0
  151. package/dist/chunk-QMAINJ4G.js.map +1 -0
  152. package/dist/{chunk-KLJVIEFW.js → chunk-SOKGYD5B.js} +7 -7
  153. package/dist/chunk-T7LKMJVA.js +142 -0
  154. package/dist/chunk-T7LKMJVA.js.map +1 -0
  155. package/dist/chunk-TFJJKM3W.js +261 -0
  156. package/dist/chunk-TFJJKM3W.js.map +1 -0
  157. package/dist/{chunk-KQ3ME6XY.js → chunk-U2EAXN3Y.js} +4 -4
  158. package/dist/chunk-UXAEOCOH.js +150 -0
  159. package/dist/chunk-UXAEOCOH.js.map +1 -0
  160. package/dist/chunk-XM4GWPXC.js +236 -0
  161. package/dist/chunk-XM4GWPXC.js.map +1 -0
  162. package/dist/index.css +76 -0
  163. package/dist/index.js +32 -32
  164. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/index.js +5 -5
  165. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-body.js +2 -2
  166. package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/index.js +7 -7
  167. package/dist/molecules/curriculumV2/CurriculumContents/curriculum-review.js +8 -8
  168. package/dist/molecules/curriculumV2/CurriculumContents/index.js +9 -9
  169. package/dist/molecules/curriculumV2/index.js +11 -11
  170. package/dist/molecules/dynamic-form-editor.js +2 -2
  171. package/dist/molecules/index.js +29 -29
  172. package/package.json +28 -2
  173. package/src/app/roleplay/chart/session-chart.tsx +185 -0
  174. package/src/app/roleplay/index.ts +8 -0
  175. package/src/app/roleplay/parts/analysis-section.tsx +98 -0
  176. package/src/app/roleplay/parts/coaching-panel.tsx +101 -0
  177. package/src/app/roleplay/parts/content.tsx +146 -0
  178. package/src/app/roleplay/parts/header.tsx +168 -0
  179. package/src/app/roleplay/parts/score-summary.tsx +158 -0
  180. package/src/app/roleplay/parts/score-trend-section.tsx +255 -0
  181. package/src/app/roleplay/parts/script-transcript.tsx +190 -0
  182. package/src/app/roleplay/parts/section-nav.tsx +299 -0
  183. package/src/app/roleplay/parts/session-replay-dialog.tsx +168 -0
  184. package/src/app/roleplay/parts/step-detail.tsx +173 -0
  185. package/src/app/roleplay/parts/step-radar.tsx +80 -0
  186. package/src/app/roleplay/parts/step-summary.tsx +149 -0
  187. package/src/app/roleplay/rp-session-detail.tsx +176 -0
  188. package/src/app/roleplay/types.ts +61 -0
  189. package/src/app/roleplay/utils/report-parse.test.ts +268 -0
  190. package/src/app/roleplay/utils/report-parse.ts +443 -0
  191. package/src/app/roleplay/utils/session-utils.ts +215 -0
  192. package/src/constrant/trainingLog.dummy.json +1 -0
  193. /package/dist/{chunk-NEJCZABQ.js.map → chunk-FJEDSUGU.js.map} +0 -0
  194. /package/dist/{chunk-TQTCT7DC.js.map → chunk-LRNO4W2P.js.map} +0 -0
  195. /package/dist/{chunk-6DWUGXSY.js.map → chunk-N242VJOP.js.map} +0 -0
  196. /package/dist/{chunk-R5UDNKV2.js.map → chunk-O332K3SW.js.map} +0 -0
  197. /package/dist/{chunk-KLJVIEFW.js.map → chunk-SOKGYD5B.js.map} +0 -0
  198. /package/dist/{chunk-KQ3ME6XY.js.map → chunk-U2EAXN3Y.js.map} +0 -0
@@ -0,0 +1,299 @@
1
+ 'use client';
2
+
3
+ import { useEffect, useState } from 'react';
4
+ import { Box, Flex, Progress, Typo } from '../../../atoms';
5
+ import type { RpReportStep } from '../utils/report-parse';
6
+ import {
7
+ stepCode,
8
+ stepColor,
9
+ stepGradeLabel,
10
+ stepRatio,
11
+ stepScoreText,
12
+ stepVars,
13
+ } from '../utils/session-utils';
14
+
15
+ export interface SectionNavItem {
16
+ id: string;
17
+ label: string;
18
+ score?: number | null;
19
+ max?: number;
20
+ }
21
+
22
+ export interface SectionNavProps {
23
+ items: SectionNavItem[];
24
+ steps: RpReportStep[];
25
+ }
26
+
27
+ const NAV_ICONS: Record<string, React.ReactNode> = {
28
+ 'score-summary': (
29
+ <>
30
+ <path d="m12 14 4-4" />
31
+ <path d="M3.34 19a10 10 0 1 1 17.32 0" />
32
+ </>
33
+ ),
34
+ strengths: (
35
+ <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
36
+ ),
37
+ improvements: (
38
+ <>
39
+ <circle cx="12" cy="12" r="9" />
40
+ <circle cx="12" cy="12" r="5" />
41
+ <circle cx="12" cy="12" r="1.5" />
42
+ </>
43
+ ),
44
+ 'score-trend': (
45
+ <>
46
+ <path d="M3 3v18h18" />
47
+ <path d="m19 8-5 5-4-4-4 4" />
48
+ </>
49
+ ),
50
+ 'step-summary': (
51
+ <path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" />
52
+ ),
53
+ 'step-detail': (
54
+ <>
55
+ <line x1="8" x2="21" y1="6" y2="6" />
56
+ <line x1="8" x2="21" y1="12" y2="12" />
57
+ <line x1="8" x2="21" y1="18" y2="18" />
58
+ <path d="M3 6h.01M3 12h.01M3 18h.01" />
59
+ </>
60
+ ),
61
+ coaching: <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />,
62
+ };
63
+
64
+ function NavIcon({ children }: { children: React.ReactNode }): React.ReactElement {
65
+ return (
66
+ <svg
67
+ aria-hidden="true"
68
+ fill="none"
69
+ height="13"
70
+ stroke="currentColor"
71
+ strokeLinecap="round"
72
+ strokeLinejoin="round"
73
+ strokeWidth="1.8"
74
+ style={{ flexShrink: 0 }}
75
+ viewBox="0 0 24 24"
76
+ width="13"
77
+ >
78
+ {children}
79
+ </svg>
80
+ );
81
+ }
82
+
83
+ function StepMetricBadge({ step }: { step: RpReportStep }): React.ReactElement | null {
84
+ const scoreText = stepScoreText(step);
85
+ if (scoreText !== null) {
86
+ return (
87
+ <Typo
88
+ as="span"
89
+ mono
90
+ style={{ flexShrink: 0, color: 'var(--gray-11)' }}
91
+ variant="body"
92
+ weight="medium"
93
+ >
94
+ {scoreText}
95
+ </Typo>
96
+ );
97
+ }
98
+ const gradeLabel = stepGradeLabel(step);
99
+ if (gradeLabel !== null) {
100
+ return (
101
+ <Typo
102
+ as="span"
103
+ mono
104
+ style={{ flexShrink: 0, color: stepVars(step).fg }}
105
+ variant="body"
106
+ weight="medium"
107
+ >
108
+ {gradeLabel}
109
+ </Typo>
110
+ );
111
+ }
112
+ return null;
113
+ }
114
+
115
+ function useScrollSpy(ids: string[]): string | null {
116
+ const [activeId, setActiveId] = useState<string | null>(null);
117
+ const watchKey = ids.join(',');
118
+
119
+ useEffect(() => {
120
+ const els = ids
121
+ .map((id) => document.getElementById(id))
122
+ .filter((el): el is HTMLElement => el !== null);
123
+ if (els.length === 0) return;
124
+
125
+ const observer = new IntersectionObserver(
126
+ (entries) => {
127
+ const visible = entries
128
+ .filter((e) => e.isIntersecting)
129
+ .sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
130
+ if (visible[0]) setActiveId(visible[0].target.id);
131
+ },
132
+ { rootMargin: '0px 0px -72% 0px', threshold: 0 }
133
+ );
134
+ els.forEach((el) => {
135
+ observer.observe(el);
136
+ });
137
+ return () => {
138
+ observer.disconnect();
139
+ };
140
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- watchKey가 ids 변경을 대표한다
141
+ }, [watchKey]);
142
+
143
+ return activeId;
144
+ }
145
+
146
+ function scrollToId(id: string): void {
147
+ document.getElementById(id)?.scrollIntoView({ behavior: 'smooth', block: 'start' });
148
+ }
149
+
150
+ export function SectionNav({ items, steps }: SectionNavProps): React.ReactElement {
151
+ const activeId = useScrollSpy(items.map((i) => i.id));
152
+ const stepDetailActive = activeId === 'step-summary' || activeId === 'step-detail';
153
+
154
+ return (
155
+ <Box asChild className="rp-section-nav">
156
+ <aside>
157
+ <Box>
158
+ <Typo
159
+ as="p"
160
+ color="gray"
161
+ style={{
162
+ paddingLeft: 'calc(var(--space-3) + 2px)',
163
+ paddingBottom: 'var(--space-1)',
164
+ }}
165
+ variant="body"
166
+ weight="medium"
167
+ >
168
+ 목차
169
+ </Typo>
170
+ <Box asChild>
171
+ <ul style={{ listStyle: 'none', margin: 0, padding: 0 }}>
172
+ {items.map((item) => {
173
+ const active = activeId === item.id;
174
+ return (
175
+ <li key={item.id}>
176
+ <button
177
+ aria-current={active ? 'true' : undefined}
178
+ className="rp-nav-btn"
179
+ onClick={() => {
180
+ scrollToId(item.id);
181
+ }}
182
+ style={
183
+ active
184
+ ? {
185
+ borderLeftColor: 'var(--accent-9)',
186
+ background: 'var(--accent-a2)',
187
+ }
188
+ : undefined
189
+ }
190
+ type="button"
191
+ >
192
+ <Flex align="center" gap="2" style={{ minWidth: 0 }}>
193
+ {NAV_ICONS[item.id] ? (
194
+ <NavIcon>{NAV_ICONS[item.id]}</NavIcon>
195
+ ) : null}
196
+ <Typo
197
+ as="span"
198
+ truncate
199
+ variant="body"
200
+ weight={active ? 'medium' : 'regular'}
201
+ >
202
+ {item.label}
203
+ </Typo>
204
+ </Flex>
205
+ {typeof item.score === 'number' ? (
206
+ <Typo as="span" mono style={{ flexShrink: 0 }} variant="body">
207
+ <Typo
208
+ as="span"
209
+ style={{
210
+ color: active ? 'var(--gray-12)' : 'var(--gray-11)',
211
+ }}
212
+ variant="body"
213
+ weight="medium"
214
+ >
215
+ {item.score}
216
+ </Typo>
217
+ <Typo as="span" style={{ color: 'var(--gray-9)' }} variant="body">
218
+ /{item.max}
219
+ </Typo>
220
+ </Typo>
221
+ ) : null}
222
+ </button>
223
+ </li>
224
+ );
225
+ })}
226
+ </ul>
227
+ </Box>
228
+
229
+ {steps.length > 0 && (
230
+ <Box mt="3" pt="3" style={{ borderTop: '1px solid var(--gray-4)' }}>
231
+ <Box pb="1" px="3">
232
+ <Typo
233
+ as="span"
234
+ style={{
235
+ color: stepDetailActive ? 'var(--gray-12)' : 'var(--gray-10)',
236
+ }}
237
+ variant="body"
238
+ weight="medium"
239
+ >
240
+ 단계별 점수
241
+ </Typo>
242
+ </Box>
243
+ <Box asChild>
244
+ <ul style={{ listStyle: 'none', margin: 0, padding: 0 }}>
245
+ {steps.map((step) => {
246
+ const ratio = stepRatio(step);
247
+ return (
248
+ <li key={step.key}>
249
+ <button
250
+ className="rp-jump-btn"
251
+ onClick={() => {
252
+ scrollToId(`step-${step.key}`);
253
+ }}
254
+ type="button"
255
+ >
256
+ <Flex align="center" gap="2" justify="between">
257
+ <Typo
258
+ as="span"
259
+ style={{ minWidth: 0 }}
260
+ truncate
261
+ variant="body"
262
+ >
263
+ <Typo
264
+ as="span"
265
+ mono
266
+ style={{ color: 'var(--gray-11)' }}
267
+ variant="body"
268
+ weight="medium"
269
+ >
270
+ {stepCode(step)}
271
+ </Typo>{' '}
272
+ <Typo
273
+ as="span"
274
+ style={{ color: 'var(--gray-9)' }}
275
+ variant="body"
276
+ >
277
+ {step.label}
278
+ </Typo>
279
+ </Typo>
280
+ <StepMetricBadge step={step} />
281
+ </Flex>
282
+ {ratio !== null ? (
283
+ <Box mt="1">
284
+ <Progress color={stepColor(step)} size="1" value={ratio * 100} />
285
+ </Box>
286
+ ) : null}
287
+ </button>
288
+ </li>
289
+ );
290
+ })}
291
+ </ul>
292
+ </Box>
293
+ </Box>
294
+ )}
295
+ </Box>
296
+ </aside>
297
+ </Box>
298
+ );
299
+ }
@@ -0,0 +1,168 @@
1
+ 'use client';
2
+
3
+ import { useEffect, useMemo, useRef, useState } from 'react';
4
+ import { Box, Dialog, Grid, Tabs } from '../../../atoms';
5
+ import { computeSpeechShare, isLengthClose } from '../utils/session-utils';
6
+ import type { RpSessionDetailData, RpSessionScript } from '../types';
7
+ import { ScriptTranscript } from './script-transcript';
8
+
9
+ export interface SessionReplayDialogProps {
10
+ open: boolean;
11
+ onOpenChange: (open: boolean) => void;
12
+ detail: RpSessionDetailData;
13
+ script?: RpSessionScript | null;
14
+ onResolveMediaUrl?: (
15
+ rawUrl: string,
16
+ options: { disposition: 'inline' | 'attachment' }
17
+ ) => string | Promise<string>;
18
+ }
19
+
20
+ type ReplayTab = 'video' | 'audio';
21
+
22
+ async function resolveUrl(
23
+ raw: string | null | undefined,
24
+ disp: 'inline' | 'attachment',
25
+ resolver?: (rawUrl: string, options: { disposition: 'inline' | 'attachment' }) => string | Promise<string>
26
+ ): Promise<string | undefined> {
27
+ if (!raw) return undefined;
28
+ if (!resolver) return raw;
29
+ try {
30
+ return await resolver(raw, { disposition: disp });
31
+ } catch {
32
+ return raw;
33
+ }
34
+ }
35
+
36
+ export function SessionReplayDialog({
37
+ open,
38
+ onOpenChange,
39
+ detail,
40
+ script,
41
+ onResolveMediaUrl,
42
+ }: SessionReplayDialogProps): React.ReactElement {
43
+ const videoRef = useRef<HTMLVideoElement>(null);
44
+ const audioRef = useRef<HTMLAudioElement>(null);
45
+
46
+ const hasVideo = Boolean(detail.trainingVideoURL);
47
+ const hasAudio = Boolean(detail.trainingAudioURL);
48
+
49
+ const [tab, setTab] = useState<ReplayTab>(hasVideo ? 'video' : 'audio');
50
+ const [currentMs, setCurrentMs] = useState(0);
51
+ const [videoSec, setVideoSec] = useState<number | null>(detail.videoDurationSec ?? null);
52
+ const [audioSec, setAudioSec] = useState<number | null>(detail.audioDurationSec ?? null);
53
+
54
+ const [resolvedVideoUrl, setResolvedVideoUrl] = useState<string | undefined>(undefined);
55
+ const [resolvedAudioUrl, setResolvedAudioUrl] = useState<string | undefined>(undefined);
56
+
57
+ useEffect(() => {
58
+ if (!open) return;
59
+ void resolveUrl(detail.trainingVideoURL, 'inline', onResolveMediaUrl).then(
60
+ setResolvedVideoUrl
61
+ );
62
+ void resolveUrl(detail.trainingAudioURL, 'inline', onResolveMediaUrl).then(
63
+ setResolvedAudioUrl
64
+ );
65
+ }, [open, detail.trainingVideoURL, detail.trainingAudioURL, onResolveMediaUrl]);
66
+
67
+ const lines = useMemo(() => script?.items ?? [], [script?.items]);
68
+ const speechShare = useMemo(() => computeSpeechShare(lines), [lines]);
69
+ const sttSec = (script?.durationMs ?? 0) / 1000;
70
+
71
+ const canSync =
72
+ tab === 'video'
73
+ ? hasVideo && isLengthClose(videoSec, sttSec)
74
+ : hasAudio && isLengthClose(audioSec, sttSec);
75
+
76
+ const activeMediaRef = tab === 'video' ? videoRef : audioRef;
77
+
78
+ const handleSeek = (startMs: number): void => {
79
+ if (!canSync) return;
80
+ const el = activeMediaRef.current;
81
+ if (!el) return;
82
+ el.currentTime = startMs / 1000;
83
+ void el.play();
84
+ };
85
+
86
+ const handleTimeUpdate = (): void => {
87
+ const el = activeMediaRef.current;
88
+ if (el) {
89
+ setCurrentMs(el.currentTime * 1000);
90
+ }
91
+ };
92
+
93
+ return (
94
+ <Dialog.Root onOpenChange={onOpenChange} open={open}>
95
+ <Dialog.Content maxWidth="1040px" title="세션 다시보기" width="100%">
96
+ <Grid
97
+ columns={{ initial: '1', md: 'minmax(0, 1fr) minmax(0, 1.05fr)' }}
98
+ gap="5"
99
+ mt="2"
100
+ >
101
+ <Box>
102
+ <Tabs.Root
103
+ onValueChange={(v) => {
104
+ setTab(v as ReplayTab);
105
+ }}
106
+ value={tab}
107
+ >
108
+ <Tabs.List>
109
+ {hasVideo ? <Tabs.Trigger value="video">영상</Tabs.Trigger> : null}
110
+ {hasAudio ? <Tabs.Trigger value="audio">오디오</Tabs.Trigger> : null}
111
+ </Tabs.List>
112
+ {hasVideo ? (
113
+ <Tabs.Content value="video">
114
+ <Box
115
+ mt="3"
116
+ style={{
117
+ borderRadius: 'var(--radius-3)',
118
+ overflow: 'hidden',
119
+ background: 'var(--gray-3)',
120
+ }}
121
+ >
122
+ {/* eslint-disable-next-line jsx-a11y/media-has-caption -- 학습 다시보기 영상은 자막 트랙이 없는 사용자 녹화본 */}
123
+ <video
124
+ controls
125
+ onLoadedMetadata={() => {
126
+ setVideoSec(videoRef.current?.duration ?? null);
127
+ }}
128
+ onTimeUpdate={handleTimeUpdate}
129
+ ref={videoRef}
130
+ src={resolvedVideoUrl}
131
+ style={{ width: '100%', display: 'block', maxHeight: 440 }}
132
+ />
133
+ </Box>
134
+ </Tabs.Content>
135
+ ) : null}
136
+ {hasAudio ? (
137
+ <Tabs.Content value="audio">
138
+ <Box mt="3">
139
+ {/* eslint-disable-next-line jsx-a11y/media-has-caption -- 학습 다시보기 오디오는 자막 트랙이 없는 사용자 녹음본 */}
140
+ <audio
141
+ controls
142
+ onLoadedMetadata={() => {
143
+ setAudioSec(audioRef.current?.duration ?? null);
144
+ }}
145
+ onTimeUpdate={handleTimeUpdate}
146
+ ref={audioRef}
147
+ src={resolvedAudioUrl}
148
+ style={{ width: '100%' }}
149
+ />
150
+ </Box>
151
+ </Tabs.Content>
152
+ ) : null}
153
+ </Tabs.Root>
154
+ </Box>
155
+
156
+ <ScriptTranscript
157
+ canSync={canSync}
158
+ currentMs={currentMs}
159
+ lines={lines}
160
+ onSeek={handleSeek}
161
+ partnerName={detail.characterTitle}
162
+ speechShare={speechShare}
163
+ />
164
+ </Grid>
165
+ </Dialog.Content>
166
+ </Dialog.Root>
167
+ );
168
+ }
@@ -0,0 +1,173 @@
1
+ 'use client';
2
+
3
+ import { Box, Flex, Progress, Typo } from '../../../atoms';
4
+ import type { RpReportStep } from '../utils/report-parse';
5
+ import {
6
+ stepCode,
7
+ stepColor,
8
+ stepGradeLabel,
9
+ stepRatio,
10
+ stepScoreText,
11
+ stepVars,
12
+ } from '../utils/session-utils';
13
+
14
+ export interface StepDetailProps {
15
+ step: RpReportStep;
16
+ scrollMarginTop?: string;
17
+ }
18
+
19
+ function RubricField({
20
+ label,
21
+ value,
22
+ }: {
23
+ label: string;
24
+ value: string;
25
+ }): React.ReactElement {
26
+ return (
27
+ <Box>
28
+ <Typo as="p" variant="body" weight="medium">
29
+ {label}
30
+ </Typo>
31
+ <Box mt="1" style={{ maxWidth: '65ch' }}>
32
+ <Typo as="p" variant="body">
33
+ {value}
34
+ </Typo>
35
+ </Box>
36
+ </Box>
37
+ );
38
+ }
39
+
40
+ export function StepDetail({
41
+ step,
42
+ scrollMarginTop = '120px',
43
+ }: StepDetailProps): React.ReactElement {
44
+ const qv = stepVars(step);
45
+ const ratio = stepRatio(step);
46
+ const scoreText = stepScoreText(step);
47
+ const gradeLabel = stepGradeLabel(step);
48
+
49
+ return (
50
+ <Box id={`step-${step.key}`} style={{ scrollMarginTop }}>
51
+ <Flex align="center" gap="2" justify="between" mb="1">
52
+ <Box style={{ minWidth: 0 }}>
53
+ <Typo as="span" color="gray" mono variant="body">
54
+ {stepCode(step)}
55
+ </Typo>
56
+ <Typo as="p" variant="subtitle" weight="bold">
57
+ {step.label}
58
+ </Typo>
59
+ </Box>
60
+ <Flex align="end" direction="column" gap="1" style={{ flexShrink: 0 }}>
61
+ {scoreText !== null ? (
62
+ <Typo
63
+ as="span"
64
+ mono
65
+ style={{ color: qv.fg }}
66
+ variant="subtitle"
67
+ weight="bold"
68
+ >
69
+ {scoreText}
70
+ </Typo>
71
+ ) : null}
72
+ {gradeLabel !== null ? (
73
+ <Typo
74
+ as="span"
75
+ mono
76
+ style={{
77
+ display: 'inline-block',
78
+ borderRadius: 'var(--radius-2)',
79
+ border: `1px solid ${qv.border}`,
80
+ background: qv.bg,
81
+ color: qv.fg,
82
+ padding: '1px 8px',
83
+ }}
84
+ variant="body"
85
+ weight="medium"
86
+ >
87
+ {gradeLabel}
88
+ </Typo>
89
+ ) : null}
90
+ </Flex>
91
+ </Flex>
92
+
93
+ {ratio !== null ? (
94
+ <Box mb="3" mt="2">
95
+ <Progress color={stepColor(step)} size="2" value={ratio * 100} />
96
+ </Box>
97
+ ) : null}
98
+
99
+ {step.description ? (
100
+ <Box mb="3" mt={ratio !== null ? '0' : '2'} style={{ maxWidth: '65ch' }}>
101
+ <Typo as="p" color="gray" variant="body">
102
+ {step.description}
103
+ </Typo>
104
+ </Box>
105
+ ) : null}
106
+
107
+ <Flex direction="column" gap="0">
108
+ {step.basis || step.issue ? (
109
+ <Box pb="3" style={{ borderBottom: '1px solid var(--gray-a4)' }}>
110
+ <Flex direction="column" gap="3">
111
+ {step.basis ? <RubricField label="근거" value={step.basis} /> : null}
112
+ {step.issue ? <RubricField label="아쉬운 점" value={step.issue} /> : null}
113
+ </Flex>
114
+ </Box>
115
+ ) : null}
116
+
117
+ {step.improve || step.example || step.idealExample ? (
118
+ <Box pt="3">
119
+ <Flex direction="column" gap="3">
120
+ {step.improve ? <RubricField label="개선점" value={step.improve} /> : null}
121
+ {step.example ? (
122
+ <Box
123
+ p="2"
124
+ style={{
125
+ borderRadius: 'var(--radius-2)',
126
+ background: 'var(--accent-a2)',
127
+ }}
128
+ >
129
+ <Typo
130
+ as="p"
131
+ style={{ color: 'var(--accent-11)' }}
132
+ variant="body"
133
+ weight="medium"
134
+ >
135
+ 예시 스크립트
136
+ </Typo>
137
+ <Box mt="1" style={{ maxWidth: '65ch' }}>
138
+ <Typo as="p" style={{ color: 'var(--accent-11)' }} variant="body">
139
+ {step.example}
140
+ </Typo>
141
+ </Box>
142
+ </Box>
143
+ ) : null}
144
+ {step.idealExample ? (
145
+ <Box
146
+ p="2"
147
+ style={{
148
+ borderRadius: 'var(--radius-2)',
149
+ background: 'var(--gray-a2)',
150
+ }}
151
+ >
152
+ <Typo as="p" color="gray" variant="body" weight="medium">
153
+ 모범 예시
154
+ </Typo>
155
+ <Box mt="1" style={{ maxWidth: '65ch' }}>
156
+ <Typo
157
+ as="p"
158
+ color="gray"
159
+ style={{ whiteSpace: 'pre-line' }}
160
+ variant="body"
161
+ >
162
+ {step.idealExample}
163
+ </Typo>
164
+ </Box>
165
+ </Box>
166
+ ) : null}
167
+ </Flex>
168
+ </Box>
169
+ ) : null}
170
+ </Flex>
171
+ </Box>
172
+ );
173
+ }