@@ -103,6 +103,7 @@ function ChapterRow({
103
103
const { onClickTimestamp} = useCrumbHandlers ( ) ;
104
104
const [ currentHoverTime ] = useCurrentHoverTime ( ) ;
105
105
const [ isHovered , setIsHovered ] = useState ( false ) ;
106
+ const [ isOpen , setIsOpen ] = useState ( false ) ;
106
107
107
108
const startOffset = Math . max ( start - ( replay ?. getStartTimestampMs ( ) ?? 0 ) , 0 ) ;
108
109
const endOffset = Math . max ( end - ( replay ?. getStartTimestampMs ( ) ?? 0 ) , 0 ) ;
@@ -113,6 +114,8 @@ function ChapterRow({
113
114
114
115
return (
115
116
< ChapterWrapper
117
+ data-has-error = { Boolean ( error ) }
118
+ data-has-feedback = { Boolean ( feedback ) }
116
119
className = { classNames ( className , {
117
120
beforeCurrentTime : hasOccurred ,
118
121
afterCurrentTime : ! hasOccurred ,
@@ -122,10 +125,9 @@ function ChapterRow({
122
125
} ) }
123
126
onMouseEnter = { ( ) => setIsHovered ( true ) }
124
127
onMouseLeave = { ( ) => setIsHovered ( false ) }
128
+ onToggle = { e => setIsOpen ( e . currentTarget . open ) }
125
129
>
126
130
< Chapter
127
- error = { error }
128
- feedback = { feedback }
129
131
onClick = { ( ) =>
130
132
trackAnalytics ( 'replay.ai-summary.chapter-clicked' , {
131
133
chapter_type : error ? 'error' : feedback ? 'feedback' : undefined ,
@@ -135,13 +137,13 @@ function ChapterRow({
135
137
>
136
138
< ChapterIconWrapper >
137
139
{ error ? (
138
- isHovered ? (
139
- < ChapterIconArrow direction = "right" size = "xs" color = "errorText " />
140
+ isOpen || isHovered ? (
141
+ < ChapterIconArrow direction = "right" size = "xs" color = "red300 " />
140
142
) : (
141
- < IconFire size = "xs" color = "errorText " />
143
+ < IconFire size = "xs" color = "red300 " />
142
144
)
143
145
) : feedback ? (
144
- isHovered ? (
146
+ isOpen || isHovered ? (
145
147
< ChapterIconArrow direction = "right" size = "xs" color = "pink300" />
146
148
) : (
147
149
< IconMegaphone size = "xs" color = "pink300" />
@@ -237,6 +239,24 @@ const ChapterWrapper = styled('details')`
237
239
&.activeChapter .beforeCurrentTime:last-child {
238
240
border-bottom-color: ${ p => p . theme . purple300 } ;
239
241
}
242
+
243
+ /* the border-top is used to eliminate some of the top gap */
244
+
245
+ &:hover {
246
+ border-top: 1px solid ${ p => p . theme . backgroundSecondary } ;
247
+ }
248
+
249
+ [data-has-feedback='true'] {
250
+ &:hover {
251
+ border-top: 1px solid ${ p => p . theme . pink100 } ;
252
+ }
253
+ }
254
+
255
+ [data-has-error='true'] {
256
+ &:hover {
257
+ border-top: 1px solid ${ p => p . theme . red100 } ;
258
+ }
259
+ }
240
260
` ;
241
261
242
262
const ChapterBreadcrumbRow = styled ( BreadcrumbRow ) `
@@ -245,29 +265,22 @@ const ChapterBreadcrumbRow = styled(BreadcrumbRow)`
245
265
&::before {
246
266
display: none;
247
267
}
248
- &:last-child {
249
- background-color: transparent;
250
- }
251
- details[open]:last-child &:last-child {
252
- background-color: ${ p => p . theme . background } ;
268
+
269
+ &:hover {
270
+ background-color: ${ p => p . theme . backgroundSecondary } ;
253
271
}
254
272
` ;
255
273
256
- const Chapter = styled ( 'summary' ) < { error ?: boolean ; feedback ?: boolean } > `
274
+ const Chapter = styled ( 'summary' ) `
257
275
cursor: pointer;
258
276
display: flex;
259
277
align-items: center;
260
278
font-size: ${ p => p . theme . fontSize . lg } ;
261
279
padding: 0 ${ space ( 0.75 ) } ;
262
- color: ${ p =>
263
- p . error ? p . theme . errorText : p . feedback ? p . theme . pink300 : p . theme . textColor } ;
280
+ color: ${ p => p . theme . textColor } ;
281
+
264
282
&:hover {
265
- background-color: ${ p =>
266
- p . error
267
- ? p . theme . red100
268
- : p . feedback
269
- ? p . theme . pink100
270
- : p . theme . backgroundSecondary } ;
283
+ background-color: ${ p => p . theme . backgroundSecondary } ;
271
284
}
272
285
273
286
/* sorry */
@@ -279,6 +292,22 @@ const Chapter = styled('summary')<{error?: boolean; feedback?: boolean}>`
279
292
&::-webkit-details-marker {
280
293
display: none;
281
294
}
295
+
296
+ [data-has-feedback='true'] & {
297
+ color: ${ p => p . theme . pink300 } ;
298
+
299
+ &:hover {
300
+ background-color: ${ p => p . theme . pink100 } ;
301
+ }
302
+ }
303
+
304
+ [data-has-error='true'] & {
305
+ color: ${ p => p . theme . red300 } ;
306
+
307
+ &:hover {
308
+ background-color: ${ p => p . theme . red100 } ;
309
+ }
310
+ }
282
311
` ;
283
312
284
313
const ChapterTitle = styled ( 'div' ) `
@@ -295,6 +324,7 @@ const ChapterTitle = styled('div')`
295
324
}
296
325
297
326
border-bottom: 1px solid ${ p => p . theme . innerBorder } ;
327
+ margin-bottom: -1px; /* Compensate for border to fully eliminate gap */
298
328
299
329
details:last-child:not([open]) & {
300
330
border-bottom: none;
0 commit comments