File tree Expand file tree Collapse file tree 1 file changed +29
-21
lines changed
frontend/src/components/Diff Expand file tree Collapse file tree 1 file changed +29
-21
lines changed Original file line number Diff line number Diff line change 11/* eslint css-modules/no-unused-class: off */
2-
32import {
43 createContext ,
54 type CSSProperties ,
@@ -147,7 +146,7 @@ function DiffBody({
147146 } ) => (
148147 < FixedSizeList
149148 className = { styles . body }
150- itemCount = { flattened . length }
149+ itemCount = { itemData . rows . length }
151150 itemData = { itemData }
152151 itemSize = { ( fontSize ?? 12 ) * 1.33 }
153152 overscanCount = { 40 }
@@ -187,6 +186,30 @@ function ThreeWayToggleButton({
187186 ) ;
188187}
189188
189+ function CompressToggleButton ( {
190+ enabled,
191+ setEnabled,
192+ } : {
193+ enabled : boolean ;
194+ setEnabled : ( enabled : boolean ) => void ;
195+ } ) {
196+ return (
197+ < button
198+ className = { styles . compressionToggle }
199+ onClick = { ( ) => {
200+ setEnabled ( ! enabled ) ;
201+ } }
202+ title = {
203+ enabled
204+ ? "Do not compress streaks of matching lines"
205+ : "Compress streaks of matching lines"
206+ }
207+ >
208+ { enabled ? < FoldIcon size = { 24 } /> : < UnfoldIcon size = { 24 } /> }
209+ </ button >
210+ ) ;
211+ }
212+
190213export function scrollToLineNumber (
191214 editorView : RefObject < EditorView > ,
192215 lineNumber : number ,
@@ -422,25 +445,10 @@ export default function Diff({
422445 ) ;
423446
424447 const compressButton = (
425- < >
426- < button
427- className = { styles . compressionToggle }
428- onClick = { ( ) => {
429- setCompressionEnabled ( ! compressionEnabled ) ;
430- } }
431- title = {
432- compressionEnabled
433- ? "Do not compress streaks of matching lines"
434- : "Compress streaks of matching lines"
435- }
436- >
437- { compressionEnabled ? (
438- < FoldIcon size = { 24 } />
439- ) : (
440- < UnfoldIcon size = { 24 } />
441- ) }
442- </ button >
443- </ >
448+ < CompressToggleButton
449+ enabled = { compressionEnabled }
450+ setEnabled = { setCompressionEnabled }
451+ />
444452 ) ;
445453
446454 return (
You can’t perform that action at this time.
0 commit comments