Skip to content

Commit

Permalink
fix(TAA-136): addresses type error, wires up now returning decision n…
Browse files Browse the repository at this point in the history
…otes
  • Loading branch information
KlimekM committed Feb 5, 2025
1 parent bd686d0 commit c44cbc5
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 26 deletions.
42 changes: 31 additions & 11 deletions assets/approval-requests-bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/modules/approval-requests/ApprovalRequestListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function ApprovalRequestListPage({
const {
approvalRequests,
errorFetchingApprovalRequests: error,
approvalRequestStatus,
setApprovalRequestStatus,
isLoading,
} = useSearchApprovalRequests();
Expand Down Expand Up @@ -60,6 +61,7 @@ function ApprovalRequestListPage({
<Container>
<XXL isBold>Approval requests</XXL>

Check warning on line 62 in src/modules/approval-requests/ApprovalRequestListPage.tsx

View workflow job for this annotation

GitHub Actions / Lint JS files

Do not use hardcoded content as the children of the XXL component
<ApprovalRequestListFilters
approvalRequestStatus={approvalRequestStatus}
setApprovalRequestStatus={setApprovalRequestStatus}
setSearchTerm={setSearchTerm}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,24 @@ const DropdownFilterField = styled(Field)`
flex: 1;
`;

const ApprovalRequestStatusInputMap = {
any: "Any",
active: "Decision pending",
approved: "Approved",
rejected: "Denied",
withdrawn: "Withdrawn",
};

interface ApprovalRequestListFiltersProps {
approvalRequestStatus: ApprovalRequestDropdownStatus;
setApprovalRequestStatus: Dispatch<
SetStateAction<ApprovalRequestDropdownStatus>
>;
setSearchTerm: Dispatch<SetStateAction<string>>;
}

function ApprovalRequestListFilters({
approvalRequestStatus,
setApprovalRequestStatus,
setSearchTerm,
}: ApprovalRequestListFiltersProps) {
Expand Down Expand Up @@ -91,8 +101,13 @@ function ApprovalRequestListFilters({
</SearchField>
<DropdownFilterField>
<Label>Status:</Label>

Check warning on line 103 in src/modules/approval-requests/components/approval-request-list/ApprovalRequestListFilters.tsx

View workflow job for this annotation

GitHub Actions / Lint JS files

Do not use hardcoded content as the children of the Label component
<Combobox isEditable={false} onChange={handleChange}>
<Option value="any" isSelected label="Any" />
<Combobox
isEditable={false}
onChange={handleChange}
selectionValue={approvalRequestStatus}
inputValue={ApprovalRequestStatusInputMap[approvalRequestStatus]}
>
<Option value="any" label="Any" />
<Option value="active" label="Decision pending" />
{/* <Option value="clarification_requested" label="Info needed" /> */}
<Option value="approved" label="Approved" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,31 @@ function ApprovalRequestDetails({
</MD>
</Col>
</DetailRow>
{/* MKTODO: need to add decided at and decision notes when returning from the API */}
{approvalRequest.decided_at && (
<DetailRow>
<Col size={4}>
<FieldLabel>Decided</FieldLabel>
</Col>
<Col size={8}>
<MD>
{formatApprovalRequestDate(
approvalRequest.decided_at,
baseLocale
)}
</MD>
</Col>
</DetailRow>
)}
{approvalRequest.decision_notes.length > 0 && (
<DetailRow>
<Col size={4}>
<FieldLabel>Comment</FieldLabel>
</Col>
<Col size={8}>
<MD>{approvalRequest.decision_notes[0]}</MD>
</Col>
</DetailRow>
)}
</Container>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import styled from "styled-components";
import { MD } from "@zendeskgarden/react-typography";
import { getColorV8 } from "@zendeskgarden/react-theming";
import { Grid } from "@zendeskgarden/react-grid";
import type { MockTicket } from "../../types";
import { Tag } from "@zendeskgarden/react-tags";
import type { ApprovalRequestTicket } from "../../types";

const TicketContainer = styled(Grid)`
padding: ${(props) => props.theme.space.md}; /* 20px */
Expand Down Expand Up @@ -36,11 +36,16 @@ const CustomFieldsGrid = styled.div`
}
`;

const NULL_VALUE_PLACEHOLDER = "-";

function CustomFieldValue({
value,
}: {
value: string | boolean | Array<string> | undefined;
}) {
if (!value) {
return <MD>{NULL_VALUE_PLACEHOLDER}</MD>;
}
if (Array.isArray(value)) {
return (
<MD>
Expand All @@ -61,7 +66,7 @@ function CustomFieldValue({
}

interface ApprovalTicketDetailsProps {
ticket: MockTicket;
ticket: ApprovalRequestTicket;
}

function ApprovalTicketDetails({ ticket }: ApprovalTicketDetailsProps) {
Expand Down
Loading

0 comments on commit c44cbc5

Please sign in to comment.