Skip to content

Commit

Permalink
feat: maintenance flag (#3863)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyjablonski authored Feb 9, 2024
1 parent ad27bb1 commit 110d220
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 2 deletions.
1 change: 1 addition & 0 deletions shared-helpers/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"account.settings.placeholders.month": "MM",
"account.settings.placeholders.year": "AAAA",
"account.settings.update": "Actualizar",
"alert.maintenance": "Este sitio está en mantenimiento programado. Nos disculpamos por cualquier inconveniente.",
"application.ada.hearing": "Para dificultades auditivas",
"application.ada.label": "Viviendas accesibles de conformidad con ADA",
"application.ada.mobility": "Para dificultades en la movilidad",
Expand Down
1 change: 1 addition & 0 deletions shared-helpers/src/locales/general.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"account.settings.placeholders.year": "YYYY",
"account.settings.update": "Update",
"account.settings.iconTitle": "generic user",
"alert.maintenance": "This site is undergoing scheduled maintenance. We apologize for any inconvenience.",
"application.ada.hearing": "For Hearing Impairments",
"application.ada.label": "ADA Accessible Units",
"application.ada.mobility": "For Mobility Impairments",
Expand Down
1 change: 1 addition & 0 deletions shared-helpers/src/locales/tl.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"account.settings.placeholders.month": "MM",
"account.settings.placeholders.year": "YYYY",
"account.settings.update": "I-update",
"alert.maintenance": "Ang site na ito ay sumasailalim sa naka-iskedyul na pagpapanatili. Humihingi kami ng paumanhin para sa anumang abala.",
"application.ada.hearing": "Para Sa Mga Kapansanan Sa Pandinig",
"application.ada.label": "Mga Accessible Unit ng ADA",
"application.ada.mobility": "Para Sa Mga Kapansanan Sa Pagkilos",
Expand Down
1 change: 1 addition & 0 deletions shared-helpers/src/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"account.settings.placeholders.month": "Tháng",
"account.settings.placeholders.year": "Năm",
"account.settings.update": "Cập nhật",
"alert.maintenance": "Trang web này đang được bảo trì theo lịch trình. Chúng tôi xin lỗi vì bất cứ sự bất tiện nào.",
"application.ada.hearing": "Dành cho các cư dân bị Suy giảm Thính lực",
"application.ada.label": "Các Căn nhà Dễ tiếp cập của ADA",
"application.ada.mobility": "Dành cho các cư dân Vận động Khó khăn",
Expand Down
1 change: 1 addition & 0 deletions shared-helpers/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"account.settings.placeholders.month": "",
"account.settings.placeholders.year": "",
"account.settings.update": "更新",
"alert.maintenance": "该网站正在进行定期维护。很抱歉给您带来不便。",
"application.ada.hearing": "聽障",
"application.ada.label": "《美國殘疾人法案》(ADA) 規定的無障礙單位",
"application.ada.mobility": "行動不便",
Expand Down
4 changes: 4 additions & 0 deletions sites/public/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ NEW_RELIC_APP_NAME=Bloom Public
NEW_RELIC_LICENSE_KEY=
SENTRY_ORG=

# YYYY-MM-DD HH:mm Z,YYYY-MM-DD HH:mm Z
# 2024-02-05 18:00 -08:00,2024-02-05 18:55 -08:00
MAINTENANCE_WINDOW=

# this GTM key is for local development only
GTM_KEY=GTM-KF22FJP

Expand Down
1 change: 1 addition & 0 deletions sites/public/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = withBundleAnalyzer({
cacheRevalidate: process.env.CACHE_REVALIDATE ? Number(process.env.CACHE_REVALIDATE) : 60,
cloudinaryCloudName: process.env.CLOUDINARY_CLOUD_NAME,
showMandatedAccounts: process.env.SHOW_MANDATED_ACCOUNTS === "TRUE",
maintenanceWindow: process.env.MAINTENANCE_WINDOW,
},
i18n: {
locales: process.env.LANGUAGES ? process.env.LANGUAGES.split(",") : ["en"],
Expand Down
13 changes: 13 additions & 0 deletions sites/public/src/layouts/application.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.site-alert-banner-container {
background-color: var(--seeds-color-alert-light);
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}

.site-alert-banner-content {
--common-message-max-width: var(--seeds-width-5xl);
--common-message-font-size: var(--seeds-font-size-base);
width: 100%;
}
23 changes: 23 additions & 0 deletions sites/public/src/layouts/application.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { useContext } from "react"
import dayjs from "dayjs"
import { useRouter } from "next/router"
import Link from "next/link"
import Head from "next/head"
import { Message } from "@bloom-housing/ui-seeds"
import {
SiteHeader,
SiteFooter,
Expand All @@ -12,6 +14,7 @@ import {
setSiteAlertMessage,
} from "@bloom-housing/ui-components"
import { AuthContext, ExygyFooter } from "@bloom-housing/shared-helpers"
import styles from "./application.module.scss"

const Layout = (props) => {
const { profile, signOut } = useContext(AuthContext)
Expand Down Expand Up @@ -70,13 +73,33 @@ const Layout = (props) => {
href: "/sign-in",
})
}
const getInMaintenance = () => {
let inMaintenance = false
const maintenanceWindow = process.env.maintenanceWindow?.split(",")
if (maintenanceWindow?.length === 2) {
const convertWindowToDate = (windowString: string) =>
dayjs(windowString, "YYYY-MM-DD HH:mm Z")
const startWindow = convertWindowToDate(maintenanceWindow[0])
const endWindow = convertWindowToDate(maintenanceWindow[1])
const now = dayjs()
inMaintenance = now > startWindow && now < endWindow
}
return inMaintenance
}

return (
<div className="site-wrapper">
<div className="site-content">
<Head>
<title>{t("nav.siteTitle")}</title>
</Head>
{getInMaintenance() && (
<div className={styles["site-alert-banner-container"]}>
<Message className={styles["site-alert-banner-content"]} variant={"alert"}>
{t("alert.maintenance")}
</Message>
</div>
)}
<SiteHeader
logoSrc="/images/logo_glyph.svg"
homeURL="/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const ApplicationChooseLanguage = () => {
listingName={listing?.name}
heading={t("application.chooseLanguage.letsGetStarted")}
progressNavProps={{
currentPageSection: 0,
currentPageSection: 1,
completedSections: 0,
labels: conductor.config.sections.map((label) => t(`t.${label}`)),
mounted: OnClientSide(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const ApplicationWhatToExpect = () => {
listingName={listing?.name}
heading={t("application.start.whatToExpect.title")}
progressNavProps={{
currentPageSection: 0,
currentPageSection: 1,
completedSections: 0,
labels: conductor.config.sections.map((label) => t(`t.${label}`)),
mounted: OnClientSide(),
Expand Down

0 comments on commit 110d220

Please sign in to comment.