Skip to content

Commit

Permalink
feat(ui): add time display mode setting to general preferences [LN-Za…
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulbile committed Nov 9, 2020
1 parent 1b64157 commit 863ac87
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module.exports = {
currency: 'USD',
locale: 'en',

// Default time dipslay mode (12Hour|24Hour).
timeDisplayMode: '12hour',

autoupdate: {
active: true,
channel: 'beta',
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',
timeDisplayMode_description: 'Your preferred time display mode.',
timeDisplayMode_option_12hour: '12 Hour',
timeDisplayMode_option_24hour: '24 Hour',
})

0 comments on commit 863ac87

Please sign in to comment.