@@ -27,31 +27,26 @@ const styles = StyleSheet.create({
2727 flexDirection : 'row' ,
2828 fontSize : 6.8 ,
2929 height : cellHeight ,
30- padding : '4.3 12' ,
31- width : 185
30+ padding : '4.3 12'
3231 } ,
3332 header : {
3433 flex : 1 ,
3534 flexDirection : 'row' ,
35+ height : cellHeight ,
3636 justifyContent : 'space-between' ,
37- padding : '3 12'
37+ padding : '4. 3 12'
3838 } ,
3939 headers : {
4040 flexDirection : 'row' ,
4141 fontSize : 6.8 ,
42- fontWeight : 'bold' ,
43- height : cellHeight ,
44- justifyContent : 'space-between' ,
45- padding : '4.3 12' ,
46- width : 185
42+ fontWeight : 'bold'
4743 } ,
4844 layerGroup : {
4945 border : `0.5 solid ${ THEME . color . blueGray25 } ` ,
5046 fontSize : 6.8 ,
5147 fontWeight : 'bold' ,
5248 height : cellHeight ,
53- padding : '4.3 12' ,
54- width : 185
49+ padding : '4.3 12'
5550 } ,
5651 layerLegend : {
5752 border : `0.5 solid ${ THEME . color . slateGray } ` ,
@@ -65,9 +60,7 @@ const styles = StyleSheet.create({
6560 } ,
6661 table : {
6762 display : 'flex' ,
68- flexDirection : 'column' ,
69- flexWrap : 'wrap' ,
70- width : '100%'
63+ flexDirection : 'column'
7164 } ,
7265 vigilanceArea : {
7366 backgroundColor : '#C58F7E' ,
@@ -90,98 +83,87 @@ export function AreaTable({
9083 [ ...regulatoryAreas ] . sort ( ( a , b ) => a . layerName . localeCompare ( b . layerName ) ) ,
9184 regulatory => regulatory . layerName
9285 )
93-
94- const groupedAmps = groupBy (
95- [ ...amps ] . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ,
96- r => r . name
97- )
98-
99- const nbHeader = 3
100- const nbColumn =
101- ( amps . length > 0 ? 1 : 0 ) + ( regulatoryAreas . length > 0 ? 1 : 0 ) + ( vigilanceAreas . length > 0 ? 1 : 0 )
102-
10386 const totalSelected = amps . length + regulatoryAreas . length + vigilanceAreas . length
10487
105- const nbCell = totalSelected + Object . keys ( groupedAmps ) . length + Object . keys ( groupedRegulatoryAreas ) . length + nbHeader
106- const tableHeight = ( nbCell * ( cellHeight + 2 ) ) / nbColumn
107-
10888 return (
10989 < >
11090 { image && < Image src = { image . image } style = { { marginBottom : 6.2 } } /> }
11191
112- < View break >
113- < View style = { layoutStyle . header } >
114- < Text style = { layoutStyle . title } > Zones</ Text >
115- < Text style = { layoutStyle . selected } > { totalSelected } sélectionnée(s)</ Text >
116- </ View >
117-
118- < View style = { [ styles . table , { height : tableHeight } ] } >
119- < View style = { [ styles . regulatoryArea , styles . headers ] } >
92+ < View style = { layoutStyle . header } >
93+ < Text style = { layoutStyle . title } > Zones</ Text >
94+ < Text style = { layoutStyle . selected } > { totalSelected } sélectionnée(s)</ Text >
95+ </ View >
96+ < View style = { styles . table } >
97+ < View style = { styles . headers } >
98+ < View style = { [ styles . regulatoryArea , styles . header ] } >
12099 < Text > Zones réglementaires</ Text >
121100 < Text > { regulatoryAreas . length } sélectionnée(s)</ Text >
122101 </ View >
123-
124- { Object . entries ( groupedRegulatoryAreas ) . map ( ( [ groupName , layers ] ) => (
125- < Fragment key = { groupName } >
126- < Text style = { styles . layerGroup } > { getTitle ( groupName ) } </ Text >
127- { layers . map ( layer => (
128- < View key = { layer . id } style = { styles . cell } >
129- < View
130- style = { [
131- styles . layerLegend ,
132- {
133- backgroundColor : getRegulatoryEnvColorWithAlpha ( layer . thematique , layer . entityName )
134- }
135- ] }
136- />
137- < Text > { layer . entityName || 'AUCUN NOM' } </ Text >
138- </ View >
139- ) ) }
140- </ Fragment >
141- ) ) }
142-
143- < View style = { [ styles . amp , styles . headers ] } >
144- < Text > Zones AMP</ Text >
102+ < View style = { [ styles . amp , styles . header ] } >
103+ < Text > Aires Marines Protégées</ Text >
145104 < Text > { amps . length } sélectionnée(s)</ Text >
146105 </ View >
147-
148- { Object . entries ( groupedAmps ) . map ( ( [ groupName , layers ] ) => (
149- < Fragment key = { groupName } >
150- < Text style = { styles . layerGroup } > { getTitle ( groupName ) } </ Text >
151- { layers . map ( layer => (
152- < View key = { layer . id } style = { styles . cell } >
153- < View
154- style = { [
155- styles . layerLegend ,
156- {
157- backgroundColor : getAMPColorWithAlpha ( layer . type , layer . name )
158- }
159- ] }
160- />
161- < Text > { layer . name || 'AUCUN NOM' } </ Text >
162- </ View >
163- ) ) }
164- </ Fragment >
165- ) ) }
166-
167- < View style = { [ styles . vigilanceArea , styles . headers ] } >
106+ < View style = { [ styles . vigilanceArea , styles . header ] } >
168107 < Text > Zones de vigilance</ Text >
169108 < Text > { vigilanceAreas . length } sélectionnée(s)</ Text >
170109 </ View >
110+ </ View >
171111
172- { vigilanceAreas . map ( vigilanceArea => (
173- < View key = { vigilanceArea . id } style = { styles . cell } >
174- < View
175- style = { [
176- styles . layerLegend ,
177- {
178- backgroundColor : getVigilanceAreaColorWithAlpha ( vigilanceArea . name , vigilanceArea . comments )
179- }
180- ] }
181- />
182- < Text > { vigilanceArea . name } </ Text >
183- </ View >
184- ) ) }
112+ < View style = { layoutStyle . row } >
113+ < View style = { { flex : 1 } } >
114+ { Object . entries ( groupedRegulatoryAreas ) . map ( ( [ groupName , layers ] ) => (
115+ < Fragment key = { groupName } >
116+ < Text style = { styles . layerGroup } wrap = { false } >
117+ { getTitle ( groupName ) }
118+ </ Text >
119+ { layers . map ( layer => (
120+ < View key = { layer . id } style = { styles . cell } wrap = { false } >
121+ < View
122+ style = { [
123+ styles . layerLegend ,
124+ {
125+ backgroundColor : getRegulatoryEnvColorWithAlpha ( layer . thematique , layer . entityName )
126+ }
127+ ] }
128+ />
129+ < Text > { layer . entityName || 'AUCUN NOM' } </ Text >
130+ </ View >
131+ ) ) }
132+ </ Fragment >
133+ ) ) }
134+ </ View >
135+ < View style = { { flex : 1 } } >
136+ { amps . map ( amp => (
137+ < View key = { amp . id } style = { styles . cell } wrap = { false } >
138+ < View
139+ style = { [
140+ styles . layerLegend ,
141+ {
142+ backgroundColor : getAMPColorWithAlpha ( amp . type , amp . name )
143+ }
144+ ] }
145+ />
146+ < Text style = { { fontWeight : 'bold' } } >
147+ { getTitle ( amp . name ) } < Text style = { { fontWeight : 'normal' } } > / { amp . type ?? 'AUCUN NOM' } </ Text >
148+ </ Text >
149+ </ View >
150+ ) ) }
151+ </ View >
152+ < View style = { { flex : 1 } } >
153+ { vigilanceAreas . map ( vigilanceArea => (
154+ < View key = { vigilanceArea . id } style = { styles . cell } wrap = { false } >
155+ < View
156+ style = { [
157+ styles . layerLegend ,
158+ {
159+ backgroundColor : getVigilanceAreaColorWithAlpha ( vigilanceArea . name , vigilanceArea . comments )
160+ }
161+ ] }
162+ />
163+ < Text > { vigilanceArea . name } </ Text >
164+ </ View >
165+ ) ) }
166+ </ View >
185167 </ View >
186168 </ View >
187169 </ >
0 commit comments