-
Notifications
You must be signed in to change notification settings - Fork 128
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
[Art/96894] - poa search tabs #33602
Changes from all commits
3f806ab
f51e08a
3656e9d
76d9682
36a87e7
fb69dfd
ca4ea86
58bada5
a8279f6
b3341fd
7d113ca
4781e19
ba66700
ef5f2fc
32237a7
1098191
9591c3c
965719b
1f7a83e
605528b
99f8ca5
7ea584a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Link } from 'react-router-dom'; | ||
import { differenceInDays } from 'date-fns'; | ||
|
||
import { | ||
formatDateParsedZoneLong, | ||
timeFromNow, | ||
} from 'platform/utilities/date/index'; | ||
|
||
const expiresSoon = expDate => { | ||
const EXPIRES_SOON_THRESHOLD_DURATION = 7 * 24 * 60 * 60 * 1000; | ||
const now = new Date(); | ||
const expiresAt = new Date(expDate); | ||
const daysLeft = timeFromNow(expiresAt, now); | ||
if ( | ||
differenceInDays(expiresAt, now) > 0 && | ||
differenceInDays(expiresAt, now) < EXPIRES_SOON_THRESHOLD_DURATION | ||
) { | ||
return `(in ${daysLeft})`; | ||
} | ||
return null; | ||
}; | ||
|
||
const POARequestCard = ({ poaRequest, id }) => { | ||
Check warning on line 25 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
Check warning on line 25 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
|
||
return ( | ||
<li> | ||
<va-card class="poa-request__card"> | ||
<span | ||
data-testid={`poa-request-card-${id}-status`} | ||
className="usa-label poa-request__card-field poa-request__card-field--status" | ||
> | ||
{poaRequest.status} | ||
Check warning on line 33 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
|
||
</span> | ||
<Link to={id}> | ||
<span className="sr-only">View details for </span> | ||
<h3 | ||
data-testid={`poa-request-card-${id}-name`} | ||
className="poa-request__card-title vads-u-font-size--h4" | ||
> | ||
{`${poaRequest.claimant.lastName}, ${ | ||
Check warning on line 41 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
Check warning on line 41 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
|
||
poaRequest.claimant.firstName | ||
Check warning on line 42 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
Check warning on line 42 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
|
||
}`} | ||
</h3> | ||
</Link> | ||
|
||
<p className="poa-request__card-field poa-request__card-field--location"> | ||
<span data-testid={`poa-request-card-${id}-city`}> | ||
{poaRequest.claimantAddress.city} | ||
Check warning on line 49 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
Check warning on line 49 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
|
||
</span> | ||
{', '} | ||
<span data-testid={`poa-request-card-${id}-state`}> | ||
{poaRequest.claimantAddress.state} | ||
Check warning on line 53 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx GitHub Actions / Linting (Files Changed)
|
||
</span> | ||
{', '} | ||
<span data-testid={`poa-request-card-${id}-zip`}> | ||
{poaRequest.claimantAddress.zip} | ||
</span> | ||
</p> | ||
|
||
<p | ||
data-testid="poa-request-card-field-received" | ||
className="poa-request__card-field poa-request__card-field--request" | ||
> | ||
{poaRequest.status === 'Declined' && ( | ||
<> | ||
<span className="poa-request__card-field--label"> | ||
POA request declined on: | ||
</span> | ||
<span data-testid={`poa-request-card-${id}-declined`}> | ||
{formatDateParsedZoneLong(poaRequest.acceptedOrDeclinedAt)} | ||
</span> | ||
</> | ||
)} | ||
{poaRequest.status === 'Accepted' && ( | ||
<> | ||
<span className="poa-request__card-field--label"> | ||
POA request accepted on: | ||
</span> | ||
<span data-testid={`poa-request-card-${id}-accepted`}> | ||
{formatDateParsedZoneLong(poaRequest.acceptedOrDeclinedAt)} | ||
</span> | ||
</> | ||
)} | ||
|
||
{poaRequest.status === 'Pending' && ( | ||
<> | ||
{expiresSoon(poaRequest.expiresAt) && ( | ||
<va-icon | ||
class="poa-request__card-icon" | ||
icon="warning" | ||
size={2} | ||
srtext="warning" | ||
aria-hidden="true" | ||
/> | ||
)} | ||
<span className="poa-request__card-field--label"> | ||
POA request expires on: | ||
</span> | ||
<span data-testid={`poa-request-card-${id}-received`}> | ||
{formatDateParsedZoneLong(poaRequest.expiresAt)} | ||
</span> | ||
<span className="poa-request__card-field--expiry"> | ||
{expiresSoon(poaRequest.expiresAt)} | ||
</span> | ||
</> | ||
)} | ||
</p> | ||
</va-card> | ||
</li> | ||
); | ||
}; | ||
|
||
POARequestCard.propTypes = { | ||
cssClass: PropTypes.string, | ||
}; | ||
|
||
export default POARequestCard; |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
icon found