@@ -33,11 +33,15 @@ const ChooseStatModal: React.FC<{
33
33
const orphanEntries = entries . filter ( ( el ) => ! ! el . stats . find ( ( st ) => st . type === statType . id ) ) ;
34
34
35
35
if ( orphanEntries . length > 0 ) {
36
- message += ` You have ${ orphanEntries . length } entries that use it! They were made on these dates: ` ;
37
- const iterations = Math . min ( 3 , orphanEntries . length ) ;
38
- for ( let i = 0 ; i < iterations ; i ++ ) {
39
- message += formatIDate ( orphanEntries [ i ] . date ) ;
40
- message += i !== iterations - 1 ? ', ' : ' ...' ;
36
+ if ( orphanEntries . length === 1 )
37
+ message += ` You have an entry from ${ formatIDate ( orphanEntries [ 0 ] . date ) } that uses it!` ;
38
+ else {
39
+ message += ` You have ${ orphanEntries . length } entries that use it! They were made on these dates: ` ;
40
+ const iterations = Math . min ( 3 , orphanEntries . length ) ;
41
+ for ( let i = 0 ; i < iterations ; i ++ ) {
42
+ message += formatIDate ( orphanEntries [ i ] . date ) ;
43
+ message += i !== iterations - 1 ? ', ' : orphanEntries . length > 3 ? ' ...' : '' ;
44
+ }
41
45
}
42
46
}
43
47
@@ -76,15 +80,15 @@ const ChooseStatModal: React.FC<{
76
80
} }
77
81
>
78
82
< View style = { GS . modalContainer } >
79
- < ScrollView keyboardShouldPersistTaps = "always" >
80
- < View style = { GS . modalBackground } >
81
- { filteredStatTypes . length === statTypes . length && statTypes . length > 1 && (
82
- < TouchableOpacity onPress = { ( ) => setReordering ( ( prevReordering ) => ! prevReordering ) } >
83
- < Text style = { { ... GS . text , marginBottom : 16 , textAlign : 'right' , color : 'blue' } } >
84
- { reordering ? 'Done' : 'Reorder' }
85
- </ Text >
86
- </ TouchableOpacity >
87
- ) }
83
+ < View style = { GS . modalBackground } >
84
+ { filteredStatTypes . length === statTypes . length && statTypes . length > 1 && (
85
+ < TouchableOpacity onPress = { ( ) => setReordering ( ( prevReordering ) => ! prevReordering ) } >
86
+ < Text style = { { ... GS . text , marginBottom : 16 , textAlign : 'right' , color : 'blue' } } >
87
+ { reordering ? 'Done' : 'Reorder' }
88
+ </ Text >
89
+ </ TouchableOpacity >
90
+ ) }
91
+ < ScrollView keyboardShouldPersistTaps = "always" >
88
92
{ filteredStatTypes . map ( ( item ) => (
89
93
< TouchableOpacity onPress = { ( ) => submitStatType ( item ) } key = { item . id } >
90
94
< View style = { GS . smallCard } >
@@ -114,17 +118,17 @@ const ChooseStatModal: React.FC<{
114
118
</ View >
115
119
</ TouchableOpacity >
116
120
) ) }
121
+ </ ScrollView >
117
122
118
- < View style = { GS . buttonRow } >
119
- < View style = { GS . button } >
120
- < Button onPress = { onAddStatType } title = "New" color = "green" />
121
- </ View >
122
- < View style = { GS . button } >
123
- < Button onPress = { onCancel } title = "Cancel" color = "grey" />
124
- </ View >
123
+ < View style = { GS . buttonRow } >
124
+ < View style = { GS . button } >
125
+ < Button onPress = { onAddStatType } title = "New" color = "green" />
126
+ </ View >
127
+ < View style = { GS . button } >
128
+ < Button onPress = { onCancel } title = "Cancel" color = "grey" />
125
129
</ View >
126
130
</ View >
127
- </ ScrollView >
131
+ </ View >
128
132
</ View >
129
133
</ Modal >
130
134
) ;
0 commit comments