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

[Art/96894] - poa search tabs #33602

Merged
merged 22 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3f806ab
switching to router loader data fetching approach
chumpy Dec 10, 2024
f51e08a
adding Suspense
chumpy Dec 10, 2024
3656e9d
96894 - adding tabs to poa request
jquispe-oddball Dec 16, 2024
76d9682
96894 - reverting update to loader for now
jquispe-oddball Dec 16, 2024
36a87e7
96894 - adding missing border bottom on mobile
jquispe-oddball Dec 16, 2024
fb69dfd
96894 - reverting from bad merge
jquispe-oddball Dec 18, 2024
ca4ea86
96894 - tab update
jquispe-oddball Dec 20, 2024
58bada5
96894 - tabs
jquispe-oddball Dec 20, 2024
a8279f6
96894 - fix active state on navlink tabs
jquispe-oddball Dec 27, 2024
b3341fd
96894- removing line
jquispe-oddball Dec 27, 2024
7d113ca
96894 - cypress and linter error fix
jquispe-oddball Dec 27, 2024
4781e19
96894 - revert
jquispe-oddball Dec 27, 2024
ba66700
[ART] POARequestsPage -> POARequestSearchPage
nihil2501 Dec 31, 2024
ef5f2fc
[ART] Fix typos in POARequestsCard unit spec
nihil2501 Dec 31, 2024
32237a7
[ARF] Consolidate `StatusTabLink`
nihil2501 Dec 31, 2024
1098191
[ART] Inline POA request list in search page
nihil2501 Dec 31, 2024
9591c3c
[ART] re-org POA search components & fix: retain tabs in empty state
nihil2501 Dec 31, 2024
965719b
[ART] Redirect POA request search param
nihil2501 Dec 31, 2024
1f7a83e
[ART] fix POA request card filename
nihil2501 Dec 31, 2024
605528b
[ART] skip cypress tests that can't understand react-router redirect
nihil2501 Dec 31, 2024
99f8ca5
removing loaders
chumpy Dec 31, 2024
7ea584a
Merge branch 'main' into art/96894/poa-search-tabs
chumpy Dec 31, 2024
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 @@ -8,7 +8,7 @@ import startReactApp from '@department-of-veterans-affairs/platform-startup/reac
import { connectFeatureToggle } from 'platform/utilities/feature-toggles';

import './sass/accredited-representative-portal.scss';
import './sass/POARequestsCard.scss';
import './sass/POARequestCard.scss';
import './sass/POARequestDetails.scss';

import manifest from './manifest.json';
Expand Down
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

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:25:27:'poaRequest' is missing in props validation

Check warning on line 25 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:25:39:'id' is missing in props validation
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

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:33:23:'poaRequest.status' is missing in props validation
</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

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:41:28:'poaRequest.claimant' is missing in props validation

Check warning on line 41 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:41:37:'poaRequest.claimant.lastName' is missing in props validation
poaRequest.claimant.firstName

Check warning on line 42 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:42:26:'poaRequest.claimant' is missing in props validation

Check warning on line 42 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:42:35:'poaRequest.claimant.firstName' is missing in props validation
}`}
</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

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:49:25:'poaRequest.claimantAddress' is missing in props validation

Check warning on line 49 in src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:49:41:'poaRequest.claimantAddress.city' is missing in props validation
</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

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/accredited-representative-portal/components/POARequestCard/POARequestCard.jsx:53:25:'poaRequest.claimantAddress' is missing in props validation
</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

Choose a reason for hiding this comment

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

icon found

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.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import PropTypes from 'prop-types';
import React, { useState } from 'react';
import { apiRequest } from '@department-of-veterans-affairs/platform-utilities/api';
import { Link, useLoaderData } from 'react-router-dom';
Expand Down Expand Up @@ -242,10 +241,6 @@ const POARequestDetailsPage = () => {
);
};

POARequestDetailsPage.propTypes = {
usePOARequests: PropTypes.func.isRequired,
};

export default POARequestDetailsPage;

export async function poaRequestLoader({ params }) {
Expand Down
Loading
Loading