Skip to content

Commit

Permalink
feat(ui): add 24 hour clock format setting [LN-Zap#3600]
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulbile committed Nov 9, 2020
1 parent 1b64157 commit df8b616
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
theme: 'dark',
currency: 'USD',
locale: 'en',
timeDisplayMode: '12Hour',

autoupdate: {
active: true,
Expand Down
24 changes: 24 additions & 0 deletions renderer/components/Settings/SettingsFieldsGeneral.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ const themeMessageMapper = key => {
return filters[key]
}

const displayModeItems = [{ key: '12Hour' }, { key: '24hour' }]
const displayModeMessageMapper = key => {
const filters = {
'12Hour': messages.timeDisplayMode_option_12hour,
'24hour': messages.timeDisplayMode_option_24hour,
}
return filters[key]
}

const SettingsFieldsGeneral = ({ currentConfig }) => {
return (
<>
Expand Down Expand Up @@ -72,6 +81,21 @@ const SettingsFieldsGeneral = ({ currentConfig }) => {

<Bar variant="light" />

<DataRow
left={<FieldLabel itemKey="timeDisplayMode" />}
right={
<Select
field="timeDisplayMode"
highlightOnValid={false}
initialValue={currentConfig.timeDisplayMode}
items={displayModeItems}
messageMapper={displayModeMessageMapper}
/>
}
/>

<Bar variant="light" />

<DataRow
left={<FieldLabel itemKey="autoupdate.active" />}
right={<Toggle field="autoupdate.active" initialValue={currentConfig.autoupdate.active} />}
Expand Down
4 changes: 4 additions & 0 deletions renderer/components/Settings/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ export default defineMessages({
payments_maxParts_label: 'Payment parts',
payments_maxParts_description:
'Maximum number of partial payments that may be used to send a payment.',
timeDisplayMode_label: 'Time display mode clock',
timeDisplayMode_description: 'Your preferred time display mode.',
timeDisplayMode_option_12hour: '12 Hour',
timeDisplayMode_option_24hour: '24 Hour',
})

0 comments on commit df8b616

Please sign in to comment.