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

Add Branded Results Header #788

Merged
merged 1 commit into from
Dec 19, 2023
Merged
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
39 changes: 39 additions & 0 deletions src/Components/Referrer/Referrer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Context } from '../Wrapper/Wrapper';
import Header from '../Header/Header';
import TwoOneOneFooter from '../TwoOneOneComponents/TwoOneOneFooter/TwoOneOneFooter';
import TwoOneOneHeader from '../TwoOneOneComponents/TwoOneOneHeader/TwoOneOneHeader';
import { FormattedMessage } from 'react-intl';

type HeaderProps = {
handleTextFieldChange: (event: Event) => void;
Expand All @@ -25,3 +26,41 @@ export const BrandedFooter = () => {
}
return <></>;
};

type ResultsHeaderProps = {
programCount: number;
programsValue: number;
taxCreditsValue: number;
};

export const BrandedResultsHeader = ({ programsValue, taxCreditsValue, programCount }: ResultsHeaderProps) => {
const { formData } = useContext(Context);

if (formData.immutableReferrer === 'lgs') {
return (
<h1 className="bottom-border program-value-header">
{programCount}
<FormattedMessage
id="results.return-programsUpToLabel"
defaultMessage=" programs with an estimated value of "
/>
${Math.round(programsValue / 12).toLocaleString()}
<FormattedMessage
id="results.return-perMonthLabel_lsg"
defaultMessage=" monthly in cash or reduced expenses for you to consider"
/>
</h1>
);
}

return (
<h1 className="bottom-border program-value-header">
{programCount}
<FormattedMessage id="results.return-programsUpToLabel" defaultMessage=" programs with an estimated value of " />$
{Math.round(programsValue / 12).toLocaleString()}
<FormattedMessage id="results.return-perMonthLabel" defaultMessage=" monthly in cash or reduced expenses, and " />
${Math.round(taxCreditsValue).toLocaleString()}
<FormattedMessage id="results.return-taxCredits" defaultMessage=" in tax credits for you to consider " />
</h1>
);
};
20 changes: 6 additions & 14 deletions src/Components/Results/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
import { citizenshipFilterOperators } from '../FilterSection/CitizenshipPopover.tsx';
import type { CitizenLabels } from '../../Assets/citizenshipFilterFormControlLabels';
import EmailResults from '../EmailResults/EmailResults.tsx';
import { BrandedResultsHeader } from '../Referrer/Referrer.tsx';

export type UpdateFilterArg =
| {
Expand Down Expand Up @@ -414,20 +415,11 @@ const Results = ({ handleTextFieldChange }: ResultsProps) => {
} else {
return (
<Grid xs={12} item>
<h1 className="bottom-border program-value-header">
{citizenshipRowCount}
<FormattedMessage
id="results.return-programsUpToLabel"
defaultMessage=" programs with an estimated value of "
/>
${Math.round(totalCitizenshipDollarValue.cashOrReducedExpenses / 12).toLocaleString()}
<FormattedMessage
id="results.return-perMonthLabel"
defaultMessage=" monthly in cash or reduced expenses, and "
/>
${Math.round(totalCitizenshipDollarValue.taxCredits).toLocaleString()}
<FormattedMessage id="results.return-taxCredits" defaultMessage=" in tax credits for you to consider " />
</h1>
<BrandedResultsHeader
programCount={citizenshipRowCount}
programsValue={totalCitizenshipDollarValue.cashOrReducedExpenses}
taxCreditsValue={totalCitizenshipDollarValue.taxCredits}
/>
</Grid>
);
}
Expand Down
Loading