-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from popovaevgeniya/019-nov-10-input-value-va…
…lidation-for-the-project 019 nov 10 input value validation for the project
- Loading branch information
Showing
15 changed files
with
909 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Converts feedback information into an object containing acceptance status and a message. | ||
* | ||
* @param accepted - A boolean indicating whether the feedback is accepted. | ||
* @param message - A string containing the feedback message. | ||
* @returns An object with `accepted` and `message` properties. | ||
*/ | ||
function feedback(accepted: boolean, message: string) { | ||
return { | ||
accepted, | ||
message, | ||
}; | ||
} | ||
|
||
/** | ||
* Select field validation | ||
* | ||
* @param value - The value to be validated. | ||
* @returns An object with `accepted` set to `true` if the value passes all validations, | ||
* otherwise an object with `accepted` set to `false` and a `message` indicating the reason. | ||
*/ | ||
function selectValidation(title: string, value: number): {accepted: boolean; message: string} { | ||
if (value === 0) { | ||
return feedback(false, `${title} is required.`); | ||
} | ||
return feedback(true, "Success"); | ||
} | ||
|
||
export default selectValidation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
352 changes: 248 additions & 104 deletions
352
Clients/src/presentation/components/AddNewRiskForm/MitigationSection/index.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
416 changes: 279 additions & 137 deletions
416
Clients/src/presentation/components/AddNewRiskForm/RisksSection/index.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.