File tree 6 files changed +28
-11
lines changed
6 files changed +28
-11
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,8 @@ const Diff = ({
89
89
onToggleChangeSelection,
90
90
areAllCollapsed,
91
91
setAllCollapsed,
92
- diffViewStyle
92
+ diffViewStyle,
93
+ appName
93
94
} ) => {
94
95
const [ isDiffCollapsed , setIsDiffCollapsed ] = useState (
95
96
isDiffCollapsedByDefault ( { type, hunks } )
@@ -121,14 +122,15 @@ const Diff = ({
121
122
} }
122
123
isDiffCompleted = { isDiffCompleted }
123
124
onCompleteDiff = { onCompleteDiff }
125
+ appName = { appName }
124
126
/>
125
127
126
128
{ ! isDiffCollapsed && (
127
129
< DiffView
128
130
viewType = { diffViewStyle }
129
131
diffType = { type }
130
132
hunks = { hunks }
131
- widgets = { getComments ( { newPath, fromVersion, toVersion } ) }
133
+ widgets = { getComments ( { newPath, fromVersion, toVersion, appName } ) }
132
134
optimizeSelection = { true }
133
135
selectedChanges = { selectedChanges }
134
136
>
Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ const LINE_CHANGE_TYPES = {
35
35
const getLineNumberWithType = ( { lineChangeType, lineNumber } ) =>
36
36
`${ LINE_CHANGE_TYPES [ lineChangeType . toUpperCase ( ) ] } ${ lineNumber } `
37
37
38
- const getComments = ( { newPath, fromVersion, toVersion } ) => {
39
- const newPathSanitized = removeAppPathPrefix ( newPath )
38
+ const getComments = ( { newPath, fromVersion, toVersion, appName } ) => {
39
+ const newPathSanitized = removeAppPathPrefix ( newPath , appName )
40
40
41
41
const versionsInDiff = getVersionsInDiff ( { fromVersion, toVersion } ) . filter (
42
42
( { comments } ) =>
Original file line number Diff line number Diff line change @@ -9,9 +9,9 @@ const FileRenameArrow = styled(props => <Icon {...props} type="right" />)`
9
9
color: #f78206;
10
10
`
11
11
12
- const FileName = ( { oldPath, newPath, type } ) => {
13
- const oldPathSanitized = removeAppPathPrefix ( oldPath )
14
- const newPathSanitized = removeAppPathPrefix ( newPath )
12
+ const FileName = ( { oldPath, newPath, type, appName } ) => {
13
+ const oldPathSanitized = removeAppPathPrefix ( oldPath , appName )
14
+ const newPathSanitized = removeAppPathPrefix ( newPath , appName )
15
15
16
16
if ( type === 'delete' ) {
17
17
return < span > { oldPathSanitized } </ span >
@@ -163,6 +163,7 @@ const DiffHeader = styled(
163
163
setIsDiffCollapsed,
164
164
isDiffCompleted,
165
165
onCompleteDiff,
166
+ appName,
166
167
...props
167
168
} ) => (
168
169
< div { ...props } >
@@ -171,7 +172,12 @@ const DiffHeader = styled(
171
172
isDiffCollapsed = { isDiffCollapsed }
172
173
onClick = { ( { altKey } ) => setIsDiffCollapsed ( ! isDiffCollapsed , altKey ) }
173
174
/>
174
- < FileName oldPath = { oldPath } newPath = { newPath } type = { type } /> { ' ' }
175
+ < FileName
176
+ oldPath = { oldPath }
177
+ newPath = { newPath }
178
+ type = { type }
179
+ appName = { appName }
180
+ /> { ' ' }
175
181
< FileStatus type = { type } />
176
182
< BinaryBadge visible = { ! hasDiff } />
177
183
< HeaderButtonsContainer >
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ const DiffSection = ({
17
17
handleCompleteDiff,
18
18
selectedChanges,
19
19
onToggleChangeSelection,
20
- diffViewStyle
20
+ diffViewStyle,
21
+ appName
21
22
} ) => {
22
23
const [ areAllCollapsed , setAllCollapsed ] = useState ( undefined )
23
24
@@ -50,6 +51,7 @@ const DiffSection = ({
50
51
onToggleChangeSelection = { onToggleChangeSelection }
51
52
areAllCollapsed = { areAllCollapsed }
52
53
setAllCollapsed = { setAllCollapsed }
54
+ appName = { appName }
53
55
/>
54
56
)
55
57
} ) }
Original file line number Diff line number Diff line change @@ -145,11 +145,17 @@ const DiffViewer = ({
145
145
{ ...diffSectionProps }
146
146
isDoneSection = { false }
147
147
diffViewStyle = { diffViewStyle }
148
+ appName = { appName }
148
149
/>
149
150
150
151
{ renderUpgradeDoneMessage ( { diff, completedDiffs } ) }
151
152
152
- < DiffSection { ...diffSectionProps } isDoneSection = { true } title = "Done" />
153
+ < DiffSection
154
+ { ...diffSectionProps }
155
+ isDoneSection = { true }
156
+ title = "Done"
157
+ appName = { appName }
158
+ />
153
159
154
160
< CompletedFilesCounter
155
161
completed = { completedDiffs . length }
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ export const getDiffPatchURL = ({ fromVersion, toVersion }) =>
12
12
export const getBinaryFileURL = ( { version, path } ) =>
13
13
`https://github.com/${ RN_DIFF_REPO } /raw/release/${ version } /${ path } `
14
14
15
- export const removeAppPathPrefix = path => path . replace ( / R n D i f f A p p \/ / , '' )
15
+ export const removeAppPathPrefix = ( path , appName ) =>
16
+ path . replace ( new RegExp ( `${ appName || 'RnDiffApp' } /` ) , '' )
16
17
17
18
export const getVersionsInDiff = ( { fromVersion, toVersion } ) => {
18
19
const cleanedToVersion = semver . valid ( semver . coerce ( toVersion ) )
You can’t perform that action at this time.
0 commit comments