Skip to content

Conversation

jmgasper
Copy link
Collaborator

const ChallengeNameField = ({ challenge, onUpdateInput }) => {
const handleChange = (e) => {
// Remove any characters that are NOT letters, numbers, or spaces
const sanitizedValue = e.target.value.replace(/[^a-zA-Z0-9 ]/g, '')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment explaining the regex pattern used for sanitizing the input. This will help future developers understand the intention behind the pattern.

value={challenge.name}
maxLength='200'
required
onChange={handleChange}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the handleChange function is correctly handling all edge cases for input sanitization. For example, verify that it doesn't inadvertently remove valid characters or fail to update the input when necessary.

const isReadOnly = checkReadOnlyRoles(auth.token) || loginUserRoleInProject === PROJECT_ROLES.READ
const isAdminOrCopilot = checkAdminOrCopilot(auth.token, activeProject)

const projectStatus = activeProject && activeProject.status

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using optional chaining (?.) to safely access status property of activeProject. This can help avoid potential errors if activeProject is null or undefined. Example: const projectStatus = activeProject?.status ? activeProject.status.toUpperCase() : ''.

/>
)}
{(checkAdmin(auth.token) || checkManager(auth.token)) && (
{(checkAdmin(auth.token) || checkManager(auth.token)) && !isCompletedOrCancelled && (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment to explain the logic behind the !isCompletedOrCancelled condition to ensure future maintainability and clarity for other developers.

@jmgasper jmgasper merged commit 5adc461 into master Aug 11, 2025
6 of 7 checks passed
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