File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "namespace" : " common" ,
3+ "strings" : {
4+ "timeframeLabel" : " Timeframe" ,
5+ "timespanLabel" : " Time Span"
6+ }
7+ }
Original file line number Diff line number Diff line change @@ -3,9 +3,12 @@ import {
33 Checklist ,
44 SelectInput ,
55} from '@ifrc-go/ui' ;
6+ import { useTranslation } from '@ifrc-go/ui/hooks' ;
67import { stringValueSelector } from '@ifrc-go/ui/utils' ;
78import { isNotDefined } from '@togglecorp/fujs' ;
89
10+ import i18n from './i18n.json' ;
11+
912type Timeframe = 'hours' | 'days' | 'months' | 'years' ;
1013
1114type TimeframeOptions = {
@@ -75,6 +78,8 @@ function TimespanInput(props: Props) {
7578 onChange,
7679 } = props ;
7780
81+ const strings = useTranslation ( i18n ) ;
82+
7883 const timespanOptions = useMemo ( ( ) => {
7984 if ( isNotDefined ( value ?. timeframe ) ) {
8085 return undefined ;
@@ -100,7 +105,7 @@ function TimespanInput(props: Props) {
100105 < >
101106 < SelectInput
102107 name = "timeframe"
103- label = "Timeframe"
108+ label = { strings . timeframeLabel }
104109 value = { value ?. timeframe }
105110 onChange = { handleTimeframeChange }
106111 options = { timeframeOptions }
@@ -109,7 +114,7 @@ function TimespanInput(props: Props) {
109114 />
110115 < Checklist
111116 name = "timespan"
112- label = "Time span"
117+ label = { strings . timespanLabel }
113118 value = { value ?. timespan }
114119 options = { timespanOptions }
115120 keySelector = { timeSpanKeySelector }
Original file line number Diff line number Diff line change 22 type ElementRef ,
33 useCallback ,
44 useRef ,
5+ useState ,
56} from 'react' ;
67import {
78 useLocation ,
@@ -39,6 +40,7 @@ import NationalSocietyMultiSelectInput from '#components/domain/NationalSocietyM
3940import NationalSocietySelectInput from '#components/domain/NationalSocietySelectInput' ;
4041import Link from '#components/Link' ;
4142import Page from '#components/Page' ;
43+ import TimespanInput , { type TimespanInputValue } from '#components/TimespanInput' ;
4244import useGlobalEnums from '#hooks/domain/useGlobalEnums' ;
4345import useAlert from '#hooks/useAlert' ;
4446import useRouting from '#hooks/useRouting' ;
@@ -74,6 +76,8 @@ export function Component() {
7476 const { navigate } = useRouting ( ) ;
7577 const { eapId : eapIdFromParams } = useParams < { eapId : string } > ( ) ;
7678
79+ const [ timespanValue , setTimespanValue ] = useState < TimespanInputValue > ( ) ;
80+
7781 const { state } = useLocation ( ) ;
7882 const eapId = eapIdFromParams ?? state ?. eapId as string | undefined ;
7983 const isReadOnly = state ?. mode === 'view' ;
@@ -520,6 +524,11 @@ export function Component() {
520524 disabled = { disabled }
521525 readOnly = { isReadOnly }
522526 />
527+ { /* NOTE: Just for testing purpose */ }
528+ < TimespanInput
529+ value = { timespanValue }
530+ onChange = { setTimespanValue }
531+ />
523532 </ InputSection >
524533 </ Container >
525534 </ div >
You can’t perform that action at this time.
0 commit comments