Skip to content

Commit

Permalink
fix: misc observed bugs in applications
Browse files Browse the repository at this point in the history
- status labels styling, categories and translations
- the notification box about handling is rendered only when viewing applications that are in handling
  • Loading branch information
vincit-matu committed Nov 14, 2024
1 parent b47b8ce commit 8722d90
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
31 changes: 18 additions & 13 deletions apps/ui/components/application/ViewApplication.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import { Checkbox } from "hds-react";
import { useTranslation } from "next-i18next";
import type {
ApplicationQuery,
Maybe,
TermsOfUseTextFieldsFragment,
import {
type ApplicationQuery,
ApplicationStatusChoice,
type Maybe,
type TermsOfUseTextFieldsFragment,
} from "@gql/gql-types";
import { getTranslation } from "@/modules/util";
import { ApplicantInfoPreview } from "./ApplicantInfoPreview";
Expand Down Expand Up @@ -34,7 +35,9 @@ export function ViewApplication({
const { t } = useTranslation();

const tos2 = application.applicationRound?.termsOfUse;

const shouldShowNotification =
application.status !== ApplicationStatusChoice.ResultsSent &&
application.status !== ApplicationStatusChoice.Draft;
return (
<>
<ApplicationSection>
Expand Down Expand Up @@ -79,14 +82,16 @@ export function ViewApplication({
</CheckboxContainer>
</Accordion>
)}
<div>
{/* Wrap the notification in a div, since HDS-notification has <section> as the root element and we need section:last-of-type to hit the last ApplicationSection */}
<StyledNotification
label={t("application:preview.notification.processing")}
>
{t("application:preview.notification.body")}
</StyledNotification>
</div>
{shouldShowNotification && (
<div>
{/* Wrap the notification in a div, since HDS-notification has <section> as the root element and we need section:last-of-type to hit the last ApplicationSection */}
<StyledNotification
label={t("application:preview.notification.processing")}
>
{t("application:preview.notification.body")}
</StyledNotification>
</div>
)}
</>
);
}
1 change: 1 addition & 0 deletions apps/ui/components/application/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const ApplicationSectionHeader = styled.h2`
[class*="statusLabel__"] {
position: relative;
transform: translateY(-4px);
${fontRegular};
}
`;

Expand Down
9 changes: 2 additions & 7 deletions apps/ui/components/applications/ApplicationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
IconCheck,
IconCogwheel,
IconCross,
IconEnvelope,
IconPen,
IconQuestionCircle,
} from "hds-react";
Expand Down Expand Up @@ -101,17 +100,13 @@ function getApplicationStatusLabelProps(
type: "success",
icon: <IconCheck aria-hidden="true" />,
};
case ApplicationStatusChoice.InAllocation:
case ApplicationStatusChoice.Handled:
case ApplicationStatusChoice.InAllocation:
case ApplicationStatusChoice.Received:
return {
type: "info",
icon: <IconCogwheel aria-hidden="true" />,
};
case ApplicationStatusChoice.Received:
return {
type: "alert",
icon: <IconEnvelope aria-hidden="true" />,
};
// These two should never be shown to the client, so they are shown as any other unexpected status
case ApplicationStatusChoice.Cancelled:
case ApplicationStatusChoice.Expired:
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/public/locales/fi/applicationCard.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"EXPIRED": "Rauennut",
"HANDLED": "Käsittelyssä",
"IN_ALLOCATION": "Käsittelyssä",
"RECEIVED": "Lähetetty",
"RECEIVED": "Käsittelyssä",
"RESULTS_SENT": "Käsitelty"
},
"reservations": "Varaukset",
Expand Down

0 comments on commit 8722d90

Please sign in to comment.