Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

front: editor - be able to select a theme #5823

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion front/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"toggle-layers": "Choose the types of elements to display",
"osrd-layers": "Data layers",
"speed-limits": "Speed limits",
"map-layers": "Map layers"
"map-layers": "Map settings"
},
"obj-types": {
"BufferStop": "Buffer stop",
Expand Down
2 changes: 1 addition & 1 deletion front/public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"toggle-layers": "Choisir les types d'éléments à afficher",
"osrd-layers": "Couches de données",
"speed-limits": "Limitations de vitesse",
"map-layers": "Couches cartographiques"
"map-layers": "Paramètres cartographiques"
},
"obj-types": {
"BufferStop": "Heurtoir",
Expand Down
2 changes: 2 additions & 0 deletions front/src/applications/editor/components/LayersModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { getMap } from 'reducers/map/selectors';
import { getInfraID } from 'reducers/osrdconf/selectors';
import { osrdEditoastApi } from 'common/api/osrdEditoastApi';
import { updateLayersSettings } from 'reducers/map';
import MapSettingsMapStyle from 'common/Map/Settings/MapSettingsMapStyle';

export const LAYERS: Array<{ layers: LayerType[]; icon: string | JSX.Element }> = [
{ layers: ['track_sections'], icon: trackSectionsIcon },
Expand Down Expand Up @@ -198,6 +199,7 @@ const LayersModal: FC<LayersModalProps> = ({
<div>
<h4>{t('Editor.nav.map-layers')}</h4>
</div>
<MapSettingsMapStyle />
<MapSettingsBackgroundSwitches />
</div>

Expand Down
32 changes: 24 additions & 8 deletions front/src/common/Map/Consts/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const colors: Record<string, Theme> = {
electricbox: {
text: '#b42222',
},
error: {
color: '#ff0000',
text: '#ff0000',
},
kp: {
circle: '#162873',
text: '#4d4f53',
Expand Down Expand Up @@ -143,10 +147,6 @@ const colors: Record<string, Theme> = {
color: '#4b4b4b',
text: '#164721',
},
error: {
color: '#ff0000',
text: '#ff0000',
},
warning: {
color: '#FF8C00',
text: '#FF8C00',
Expand Down Expand Up @@ -175,6 +175,10 @@ const colors: Record<string, Theme> = {
electricbox: {
text: '#b42222',
},
error: {
color: '#ff0000',
text: '#ff0000',
},
kp: {
circle: '#8338ec',
text: '#8338ec',
Expand Down Expand Up @@ -295,6 +299,10 @@ const colors: Record<string, Theme> = {
color: '#ffbe0b',
text: '#ffbe0b',
},
warning: {
color: '#FF8C00',
text: '#FF8C00',
},
},
/* ***************************************************************************
*
Expand All @@ -319,6 +327,10 @@ const colors: Record<string, Theme> = {
electricbox: {
text: bpLight,
},
error: {
color: '#ff0000',
text: '#ff0000',
},
kp: {
circle: bpLight,
text: bpLight,
Expand Down Expand Up @@ -439,6 +451,10 @@ const colors: Record<string, Theme> = {
color: bpMedium,
text: bpMedium,
},
warning: {
color: '#FF8C00',
text: '#FF8C00',
},
},
/* ***************************************************************************
*
Expand All @@ -463,6 +479,10 @@ const colors: Record<string, Theme> = {
electricbox: {
text: '#b42222',
},
error: {
color: '#ff0000',
text: '#ff0000',
},
kp: {
circle: '#162873',
text: '#4d4f53',
Expand Down Expand Up @@ -583,10 +603,6 @@ const colors: Record<string, Theme> = {
color: '#4b4b4b',
text: '#164721',
},
error: {
color: '#ff0000',
text: '#ff0000',
},
warning: {
color: '#FF8C00',
text: '#FF8C00',
Expand Down
49 changes: 26 additions & 23 deletions front/src/common/Map/Map.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,6 @@
@media screen and (min-width: 640px) {
max-width: 50%;
}
button.mapstyle-style-select {
border: none;
background-color: #f2f2f2;
padding: 0;
display: flex;
align-items: center;
text-align: left;
border-radius: 8px;
margin-right: 1rem;
padding-right: 0.5rem;
img {
width: 5rem;
border-radius: 8px 0 0 8px;
margin-right: 0.5rem;
}
font-size: 0.9rem;
&:hover,
&.active {
background-color: #333;
color: #fff;
}
}

.sub-section-title {
cursor: pointer;
i {
Expand Down Expand Up @@ -122,6 +99,32 @@
border-color: var(--coolgray13);
}
}

.mapstyle {
button.mapstyle-style-select {
border: none;
background-color: #f2f2f2;
padding: 0;
display: flex;
align-items: center;
text-align: left;
border-radius: 8px;
margin-right: 1rem;
padding-right: 0.5rem;
img {
width: 5rem;
border-radius: 8px 0 0 8px;
margin-right: 0.5rem;
}
font-size: 0.9rem;
&:hover,
&.active {
background-color: #333;
color: #fff;
}
}
}

.map-search-marker {
/* Circle center */
margin-left: -16px;
Expand Down
3 changes: 2 additions & 1 deletion front/src/common/Map/Settings/MapSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { FC, useState } from 'react';
import { useTranslation } from 'react-i18next';

import MapSettingsLayers from 'common/Map/Settings/MapSettingsLayers';
import MapSettingsMapStyle from 'common/Map/Settings/MapSettingsMapStyle';
import MapSettingsBackgroundSwitches from 'common/Map/Settings/MapSettingsBackgroundSwitches';
import MapSettingsSpeedLimits from 'common/Map/Settings/MapSettingsSpeedLimits';
import { useTranslation } from 'react-i18next';
import HearderPopUp from '../HeaderPopUp';

interface MapSettingsProps {
Expand Down
2 changes: 1 addition & 1 deletion front/src/common/Map/Settings/MapSettingsMapStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const MapSettingsMapStyle: FC<unknown> = () => {
const dispatch = useDispatch();

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