Skip to content
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

Merged
merged 2 commits into from
Jan 22, 2024

Conversation

markdavella
Copy link
Collaborator

  • 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);
Copy link
Owner

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 = {
Copy link
Owner

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>(
Copy link
Owner

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

@markdavella markdavella merged commit 1e987a7 into chrisbenincasa:main Jan 22, 2024
1 check passed
@markdavella markdavella deleted the control-settings branch January 22, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants