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

[TC-903] Declining Text #494

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ export const InitialRecommitmentDropdown = ({
}
};

const getWarningText = () => {
if (initialValue === 'no') {
if (program === Program.ALL) {
return 'You must provide a reason for declining recommitment to each program in the next step.';
} else {
return `You must provide a reason for declining recommitment to the ${program?.toUpperCase()} program in the next step.`;
}
} else {
return `You must provide a reason for declining recommitment to the ${initialValue === 'bcws-only' ? 'EMCR' : 'BCWS'} program in the next step.`;
}
}

const EMCR_ONLY_OPTIONS = [
{ value: 'yes-emcr', label: 'Yes' },
{ value: 'no', label: `No, I am not returning this year` },
Expand Down Expand Up @@ -61,7 +73,7 @@ export const InitialRecommitmentDropdown = ({
))}
</Select>
{initialValue && !['yes-emcr', 'yes-bcws', 'yes-both'].includes(initialValue) &&
<p className="text-xs text-gray-600 pb-1 pt-4 pl-1">You must provide a reason for declining recommitment to each program in the next step.</p>
<p className="text-xs text-gray-600 pb-1 pt-4 pl-1">{getWarningText()}</p>
}
</div>
);
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/recommitment/UnableToJoin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
}, [reasons]);

const handleCheckboxChange = (program: Program, reasonId: string) => {
setReasons((prev) => {

Check warning on line 52 in frontend/src/components/recommitment/UnableToJoin.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'onUpdate'. Either include it or remove the dependency array. If 'onUpdate' changes too often, find the parent component that defines it and wrap that definition in useCallback

Check warning on line 52 in frontend/src/components/recommitment/UnableToJoin.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'onUpdate'. Either include it or remove the dependency array. If 'onUpdate' changes too often, find the parent component that defines it and wrap that definition in useCallback
const programPreviousReasons = prev[program]?.selectedReasons || [];
const newReasons = programPreviousReasons.includes(reasonId)
? programPreviousReasons.filter((id) => id !== reasonId)
Expand Down Expand Up @@ -117,8 +117,14 @@
onChange={(e) => handleOtherReasonChange(program as Program, e.target.value)}
placeholder="Add a comment"
rows={3}
maxLength={100}
className="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-sm"
/>
{(reasons[program as Program]?.otherReason || '').length === 100 &&
<p className="text-sm text-red-600">
Maximum character limit of 100
</p>
}
</div>
)}
</div>
Expand Down
Loading