Skip to content

Commit

Permalink
✨ Add assessed archetypes section in drawer:
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 committed Dec 11, 2023
1 parent e99029b commit b20aa62
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
"associatedApplications": "Associated applications",
"associatedArchetypes": "Associated archetypes",
"archetypesReviewed": "Archetypes reviewed",
"archetypesAssessed": "Archetypes assessed",
"add": "Add",
"additionalNotesOrComments": "Additional notes or comments",
"adoptionCandidateDistribution": "Application confidence and risk",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { LabelsFromItems } from "@app/components/labels/labels-from-items/labels
import { ReviewedArchetypeItem } from "./reviewed-archetype-item";
import { RiskLabel } from "@app/components/RiskLabel";
import { ApplicationDetailFields } from "./application-detail-fields";
import { AssessedArchetypeItem } from "./assessed-archetype-item";

export interface IApplicationDetailDrawerProps
extends Pick<IPageDrawerContentProps, "onCloseClick"> {
Expand Down Expand Up @@ -180,6 +181,23 @@ export const ApplicationDetailDrawer: React.FC<
)}
</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>
{t("terms.archetypesAssessed")}
</DescriptionListTerm>
<DescriptionListDescription>
{application?.archetypes?.length ?? 0 > 0 ? (
application?.archetypes?.map((archetypeRef) => (
<AssessedArchetypeItem
key={archetypeRef.id}
id={archetypeRef.id}
/>
))
) : (
<EmptyTextMessage message={t("terms.none")} />
)}
</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>
{t("terms.archetypesReviewed")}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useFetchArchetypeById } from "@app/queries/archetypes";
import { Label } from "@patternfly/react-core";
import React from "react";

export const AssessedArchetypeItem = ({ id }: { id: number }) => {
const { archetype } = useFetchArchetypeById(id);

if (!archetype?.assessed) return null;

return (
<Label color="grey" key={id}>
{archetype.name}
</Label>
);
};

0 comments on commit b20aa62

Please sign in to comment.