Skip to content

Commit 25ecf3b

Browse files
committed
front: editor - be able to select a theme
Close #5806 & #5821 - Adding the MapSettingsMapStyle component in the editor settings, and for that I changed a little bit the CSS. - sync labels of data and map layer in the editor with the one on the map. - adding missing color to some theme (see #5821)
1 parent 8ddf0c8 commit 25ecf3b

File tree

7 files changed

+57
-35
lines changed

7 files changed

+57
-35
lines changed

front/public/locales/en/translation.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
"toggle-layers": "Choose the types of elements to display",
189189
"osrd-layers": "Data layers",
190190
"speed-limits": "Speed limits",
191-
"map-layers": "Map layers"
191+
"map-layers": "Map settings"
192192
},
193193
"obj-types": {
194194
"BufferStop": "Buffer stop",

front/public/locales/fr/translation.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
"toggle-layers": "Choisir les types d'éléments à afficher",
189189
"osrd-layers": "Couches de données",
190190
"speed-limits": "Limitations de vitesse",
191-
"map-layers": "Couches cartographiques"
191+
"map-layers": "Paramètres cartographiques"
192192
},
193193
"obj-types": {
194194
"BufferStop": "Heurtoir",

front/src/applications/editor/components/LayersModal.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { getMap } from 'reducers/map/selectors';
2323
import { getInfraID } from 'reducers/osrdconf/selectors';
2424
import { osrdEditoastApi } from 'common/api/osrdEditoastApi';
2525
import { updateLayersSettings } from 'reducers/map';
26+
import MapSettingsMapStyle from 'common/Map/Settings/MapSettingsMapStyle';
2627

2728
export const LAYERS: Array<{ layers: LayerType[]; icon: string | JSX.Element }> = [
2829
{ layers: ['track_sections'], icon: trackSectionsIcon },
@@ -198,6 +199,7 @@ const LayersModal: FC<LayersModalProps> = ({
198199
<div>
199200
<h4>{t('Editor.nav.map-layers')}</h4>
200201
</div>
202+
<MapSettingsMapStyle />
201203
<MapSettingsBackgroundSwitches />
202204
</div>
203205

front/src/common/Map/Consts/colors.ts

+24-8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const colors: Record<string, Theme> = {
2323
electricbox: {
2424
text: '#b42222',
2525
},
26+
error: {
27+
color: '#ff0000',
28+
text: '#ff0000',
29+
},
2630
kp: {
2731
circle: '#162873',
2832
text: '#4d4f53',
@@ -143,10 +147,6 @@ const colors: Record<string, Theme> = {
143147
color: '#4b4b4b',
144148
text: '#164721',
145149
},
146-
error: {
147-
color: '#ff0000',
148-
text: '#ff0000',
149-
},
150150
warning: {
151151
color: '#FF8C00',
152152
text: '#FF8C00',
@@ -175,6 +175,10 @@ const colors: Record<string, Theme> = {
175175
electricbox: {
176176
text: '#b42222',
177177
},
178+
error: {
179+
color: '#ff0000',
180+
text: '#ff0000',
181+
},
178182
kp: {
179183
circle: '#8338ec',
180184
text: '#8338ec',
@@ -295,6 +299,10 @@ const colors: Record<string, Theme> = {
295299
color: '#ffbe0b',
296300
text: '#ffbe0b',
297301
},
302+
warning: {
303+
color: '#FF8C00',
304+
text: '#FF8C00',
305+
},
298306
},
299307
/* ***************************************************************************
300308
*
@@ -319,6 +327,10 @@ const colors: Record<string, Theme> = {
319327
electricbox: {
320328
text: bpLight,
321329
},
330+
error: {
331+
color: '#ff0000',
332+
text: '#ff0000',
333+
},
322334
kp: {
323335
circle: bpLight,
324336
text: bpLight,
@@ -439,6 +451,10 @@ const colors: Record<string, Theme> = {
439451
color: bpMedium,
440452
text: bpMedium,
441453
},
454+
warning: {
455+
color: '#FF8C00',
456+
text: '#FF8C00',
457+
},
442458
},
443459
/* ***************************************************************************
444460
*
@@ -463,6 +479,10 @@ const colors: Record<string, Theme> = {
463479
electricbox: {
464480
text: '#b42222',
465481
},
482+
error: {
483+
color: '#ff0000',
484+
text: '#ff0000',
485+
},
466486
kp: {
467487
circle: '#162873',
468488
text: '#4d4f53',
@@ -583,10 +603,6 @@ const colors: Record<string, Theme> = {
583603
color: '#4b4b4b',
584604
text: '#164721',
585605
},
586-
error: {
587-
color: '#ff0000',
588-
text: '#ff0000',
589-
},
590606
warning: {
591607
color: '#FF8C00',
592608
text: '#FF8C00',

front/src/common/Map/Map.scss

+26-23
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,6 @@
3333
@media screen and (min-width: 640px) {
3434
max-width: 50%;
3535
}
36-
button.mapstyle-style-select {
37-
border: none;
38-
background-color: #f2f2f2;
39-
padding: 0;
40-
display: flex;
41-
align-items: center;
42-
text-align: left;
43-
border-radius: 8px;
44-
margin-right: 1rem;
45-
padding-right: 0.5rem;
46-
img {
47-
width: 5rem;
48-
border-radius: 8px 0 0 8px;
49-
margin-right: 0.5rem;
50-
}
51-
font-size: 0.9rem;
52-
&:hover,
53-
&.active {
54-
background-color: #333;
55-
color: #fff;
56-
}
57-
}
58-
5936
.sub-section-title {
6037
cursor: pointer;
6138
i {
@@ -122,6 +99,32 @@
12299
border-color: var(--coolgray13);
123100
}
124101
}
102+
103+
.mapstyle {
104+
button.mapstyle-style-select {
105+
border: none;
106+
background-color: #f2f2f2;
107+
padding: 0;
108+
display: flex;
109+
align-items: center;
110+
text-align: left;
111+
border-radius: 8px;
112+
margin-right: 1rem;
113+
padding-right: 0.5rem;
114+
img {
115+
width: 5rem;
116+
border-radius: 8px 0 0 8px;
117+
margin-right: 0.5rem;
118+
}
119+
font-size: 0.9rem;
120+
&:hover,
121+
&.active {
122+
background-color: #333;
123+
color: #fff;
124+
}
125+
}
126+
}
127+
125128
.map-search-marker {
126129
/* Circle center */
127130
margin-left: -16px;

front/src/common/Map/Settings/MapSettings.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React, { FC, useState } from 'react';
2+
import { useTranslation } from 'react-i18next';
3+
24
import MapSettingsLayers from 'common/Map/Settings/MapSettingsLayers';
35
import MapSettingsMapStyle from 'common/Map/Settings/MapSettingsMapStyle';
46
import MapSettingsBackgroundSwitches from 'common/Map/Settings/MapSettingsBackgroundSwitches';
57
import MapSettingsSpeedLimits from 'common/Map/Settings/MapSettingsSpeedLimits';
6-
import { useTranslation } from 'react-i18next';
78
import HearderPopUp from '../HeaderPopUp';
89

910
interface MapSettingsProps {

front/src/common/Map/Settings/MapSettingsMapStyle.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const MapSettingsMapStyle: FC<unknown> = () => {
1616
const dispatch = useDispatch();
1717

1818
return (
19-
<div className="row ml-1">
19+
<div className="row ml-1 mapstyle">
2020
<button
2121
className={cx('col-xs-4 mb-2 mapstyle-style-select', mapStyle === 'normal' && 'active')}
2222
type="button"

0 commit comments

Comments
 (0)