-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Settings page use controlled components #4
Make Settings page use controlled components #4
Conversation
markdavella
commented
Jan 19, 2024
- Created utility for detect when strings contain only numbers
- Made nearly all setting form fields controlled
- experimenting with styling of overall setting pages/tabs
@@ -50,3 +50,7 @@ export const fromStringResolution = ( | |||
const [h, w] = res.split('x', 1); | |||
return { widthPx: parseInt(w), heightPx: parseInt(h) }; | |||
}; | |||
|
|||
export const hasOnlyDigits = (value: string) => { | |||
return /^-?\d+$/.test(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should prob add the global flag to the regex: /^-?\d+$/g
{ value: 160, string: '3 Seconds' }, | ||
{ value: 180, string: '4 Seconds' }, | ||
]; | ||
|
||
const defaultPlexSettings = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be available in the dizquetv-types
paackage
setMaxPlayableResolution(event.target.value as string); | ||
}; | ||
|
||
const [maxDirectStreamBitrate, setMaxDirectStreamBitrate] = useState<string>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nit - you shouldnt have to be explicit about the type if it is obvious. vscode/typescript will infer the type as string in this case