Skip to content

Commit 933538b

Browse files
author
Ruizhe Pang
committed
Modify isNaN(val) to Number.isNaN(val)
1 parent 1ed0104 commit 933538b

File tree

5 files changed

+63
-30
lines changed

5 files changed

+63
-30
lines changed

src/renderer/components/notifications/__snapshots__/AccountNotifications.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/components/notifications/__snapshots__/NotificationFooter.test.tsx.snap

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/components/notifications/__snapshots__/NotificationRow.test.tsx.snap

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/components/settings/NotificationSettings.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,25 +247,32 @@ export const NotificationSettings: FC = () => {
247247
}
248248
/>
249249

250-
<Box>
250+
<Stack direction="horizontal" gap="condensed" alignItems="center">
251251
<Text as="label" htmlFor="notificationVolume">
252-
Notification Volume: {settings.notificationVolume}%
252+
Notification Volume:
253253
</Text>
254254
<input
255255
id="notificationVolume"
256-
type="range"
256+
type="number"
257257
min={0}
258258
max={100}
259259
step={1}
260260
value={settings.notificationVolume}
261-
onChange={(evt) =>
262-
updateSetting(
263-
'notificationVolume',
264-
Number.parseInt(evt.target.value, 10),
265-
)
266-
}
261+
onChange={(evt) => {
262+
let val = Number(evt.target.value);
263+
if (Number.isNaN(val)) val = 0;
264+
if (val > 100) val = 100;
265+
if (val < 0) val = 0;
266+
updateSetting('notificationVolume', val);
267+
}}
268+
style={{
269+
width: '3rem',
270+
textAlign: 'center',
271+
border: '1px solid #ccc',
272+
borderRadius: '4px',
273+
}}
267274
/>
268-
</Box>
275+
</Stack>
269276
</Stack>
270277
</fieldset>
271278
);

src/renderer/routes/__snapshots__/Settings.test.tsx.snap

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)