@@ -2,7 +2,7 @@ import { Box, Heading } from '@chakra-ui/react';
2
2
import { updateStationName , updateStationNum , updateStationSecondaryName } from '../../../redux/param/action' ;
3
3
import { useRootDispatch , useRootSelector } from '../../../redux' ;
4
4
import { RmgStyle } from '../../../constants/constants' ;
5
- import { RmgFields , RmgFieldsField } from '@railmapgen/rmg-components' ;
5
+ import { RmgButtonGroup , RmgFields , RmgFieldsField } from '@railmapgen/rmg-components' ;
6
6
import { useTranslation } from 'react-i18next' ;
7
7
8
8
export default function InfoSection ( ) {
@@ -35,14 +35,33 @@ export default function InfoSection() {
35
35
value : name [ 1 ] ,
36
36
onChange : ( value : string ) => dispatch ( updateStationName ( selectedStation , [ name [ 0 ] , value ] ) ) ,
37
37
} ,
38
+ {
39
+ type : 'custom' ,
40
+ label : t ( 'Secondary names' ) ,
41
+ component : (
42
+ < RmgButtonGroup
43
+ selections = {
44
+ [
45
+ { label : t ( 'Yes' ) , value : true } ,
46
+ { label : t ( 'No' ) , value : false } ,
47
+ ] as { label : string ; value : boolean } [ ]
48
+ }
49
+ defaultValue = { ! ! secondaryName }
50
+ onChange = { flag =>
51
+ dispatch ( updateStationSecondaryName ( selectedStation , flag ? [ '' , '' ] : undefined ) )
52
+ }
53
+ />
54
+ ) ,
55
+ hidden : ! [ RmgStyle . GZMTR ] . includes ( style ) ,
56
+ } ,
38
57
{
39
58
type : 'input' ,
40
59
label : t ( 'StationSidePanel.info.zhSecondary' ) ,
41
60
value : secondaryName ? secondaryName [ 0 ] : '' ,
42
61
placeholder : '1号航站楼' ,
43
62
onChange : ( value : string ) =>
44
63
dispatch ( updateStationSecondaryName ( selectedStation , [ value , secondaryName ? secondaryName [ 1 ] : '' ] ) ) ,
45
- hidden : ! [ RmgStyle . GZMTR ] . includes ( style ) ,
64
+ hidden : ! secondaryName || ! [ RmgStyle . GZMTR ] . includes ( style ) ,
46
65
} ,
47
66
{
48
67
type : 'input' ,
@@ -51,7 +70,7 @@ export default function InfoSection() {
51
70
placeholder : 'Terminal 1' ,
52
71
onChange : ( value : string ) =>
53
72
dispatch ( updateStationSecondaryName ( selectedStation , [ secondaryName ? secondaryName [ 0 ] : '' , value ] ) ) ,
54
- hidden : ! [ RmgStyle . GZMTR ] . includes ( style ) ,
73
+ hidden : ! secondaryName || ! [ RmgStyle . GZMTR ] . includes ( style ) ,
55
74
} ,
56
75
] ;
57
76
0 commit comments