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

ONI-168: make a notice message larger #18

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 20 additions & 7 deletions src/components/HomePageContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
useModulesManager,
useTranslations,
} from "@openimis/fe-core";
import { useDispatch, useSelector } from "react-redux";
import { useSelector } from "react-redux";

import { DEFAULT, MODULE_NAME, DAYS_HF_STATUS } from "../constants";
import { useFetchData } from "../hooks/useFetchData";
Expand All @@ -21,9 +21,11 @@ const useStyles = makeStyles((theme) => ({
messageTitle: {
textAlign: "center",
color: "red",
fontSize: "16px"
},
messageDate: {
textAlign: "center",
fontSize: "16px",
},
healthFacilityLongTimeActive: {
textAlign: "center",
Expand All @@ -36,6 +38,9 @@ const useStyles = makeStyles((theme) => ({
textAlign: "center",
color: "red",
},
messageNotice: {
fontSize: "16px"
}
}));

const HomePageContainer = () => {
Expand All @@ -58,7 +63,7 @@ const HomePageContainer = () => {
const showHealthFacilityMessage = modulesManager.getConf(
"fe-home",
"HomePageContainer.showHealthFacilityMessage",
false
DEFAULT.SHOW_HEALTH_FACILITY_MESSAGE
);

const { user } = useUserQuery();
Expand Down Expand Up @@ -100,10 +105,15 @@ const HomePageContainer = () => {
{showHealthFacilityMessage && (
<Grid item xs={12}>
<h2 className={getHealthFacilityStatus(timeDelta)}>
{formatMessageWithValues("HomePageContainer.healthFacilityStatus", {
date: `${formatDateFromISO(dateToCheck)}`,
days: `${timeDelta}`,
})}
{userHealthFacility
? formatMessageWithValues(
"HomePageContainer.healthFacilityStatus",
{
date: `${formatDateFromISO(dateToCheck)}`,
days: `${timeDelta}`,
}
)
: formatMessage("HomePageContainer.noHealthFacilityAssigned")}
</h2>
</Grid>
)}
Expand All @@ -114,7 +124,10 @@ const HomePageContainer = () => {
{formatMessage("HomePageContainer.messageTitle")}
</h3>
<p className={classes.messageDate}> {messageData?.date} </p>
<div dangerouslySetInnerHTML={{ __html: messageData?.notice }} />
<div
className={classes.messageNotice}
dangerouslySetInnerHTML={{ __html: messageData?.notice }}
/>
</Grid>
)}
<Contributions contributionKey="home.HomePage.Blocks" user={user} />
Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const DEFAULT = {
SHOW_HOME_MESSAGE: false,
HOME_MESSAGE_URL: "",
SHOW_HEALTH_FACILITY_MESSAGE: false,
};

export const DAYS_HF_STATUS = {
Expand Down
3 changes: 2 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"home.HomePageContainer.welcomeMessage": "Welcome {otherNames} {lastName}!",
"home.HomePageContainer.messageTitle": "Notice",
"home.HomePageContainer.healthFacilityStatus": "Your Hospital Contract is expiring on {date}: (Remaining days: {days})"
"home.HomePageContainer.healthFacilityStatus": "Your Hospital Contract is expiring on {date}: (Remaining days: {days})",
"home.HomePageContainer.noHealthFacilityAssigned": "User has no Health Facility assigned and there is no information on when the contract will expire."
}