From dc8958f7a1d35abf99f08e31127da3d59e16aa21 Mon Sep 17 00:00:00 2001 From: robbond Date: Wed, 4 Feb 2026 11:19:35 +0000 Subject: [PATCH] updated service status down functionality --- components/case.js | 2 + components/header.js | 5 +- components/main.js | 4 +- components/servicebanner.js | 124 ++++++++++++++++++++++++++++-------- pages/auth/signin.js | 18 +++--- pages/auth/signin2.js | 6 +- pages/status.js | 75 ++++++++++++++++++++-- 7 files changed, 189 insertions(+), 45 deletions(-) diff --git a/components/case.js b/components/case.js index 915dc95d..c47b2f52 100644 --- a/components/case.js +++ b/components/case.js @@ -41,7 +41,9 @@ const Case = (props) => { docsOffline={props.props.docsOffline} documentDetailsObj={props.documentDetailsObj} showFilteredDocs={props.showFilteredDocs} + showLoginCheck={props.showLoginCheck} eventsObj={props.eventsObj} + mediaObj={props.mediaObj} /> {showRepresentations == true && ( { "/myportal/contactus", "/unsubscribe/[watchlistid]", "/unsubscribeall/[watchlistid]", + "/status", ]; const hasContactLink = [ @@ -84,14 +85,14 @@ const Header = (props) => { const handleLogout = () => { console.info("////////////\n" + "logout" + "\n////////////"); - window.localStorage.clear(), + (window.localStorage.clear(), destroyCookie(null, "next-auth.csrf-token", { path: "/" }), destroyCookie(null, "next-auth.callback-url", { path: "/" }), destroyCookie(null, "pedw_locale", { path: "/" }), destroyCookie(null, "pinsUser", { path: "/" }), signOut({ callbackUrl: locale == "cy" ? "/cy/allgofnodi" : "/logout", - }); + })); }; //const switchLocale = locale === "en" ? "cy" : "en"; diff --git a/components/main.js b/components/main.js index 382ce73b..402b3b44 100644 --- a/components/main.js +++ b/components/main.js @@ -24,8 +24,10 @@ const MainHome = (props) => {
{showLogin != "true" && ( <> - + {/* + */} + )} {showLogin == "true" && ( diff --git a/components/servicebanner.js b/components/servicebanner.js index 324c82ee..75a8569f 100644 --- a/components/servicebanner.js +++ b/components/servicebanner.js @@ -1,46 +1,118 @@ import useTranslation from "next-translate/useTranslation"; import router from "next/router"; import Link from "next/link"; +import CaseNoticeBanner from "./case/caseNoticeBanner"; export default function ServiceBanner(props) { let { t, lang } = useTranslation(); + const showSigninFromEnv = true; + const showNoticeFromEnv = false; + + // keep backwards-compat with existing usage + const showSignin = props?.noSignin === true ? false : showSigninFromEnv; + const signInButton = () => { router.push( `${ router.locale == "cy" ? "/awd/mewngofnodi" : "/auth/signin" }?callbackUrl=${encodeURIComponent( - window.location.href - )}&error=EmailSignin` + window.location.href, + )}&error=EmailSignin`, ); }; return ( -
-

- Planning casework -

- {props.noSignin != true && ( -
- +
+ )} +
+ + {showNoticeFromEnv && ( +
+
- {t("common:signin-label")} - + + + Announcement + + +
+
+

+ {router.locale == "cy" + ? "Cyhoeddiad" + : "Announcement"} +

+
+
+ {router.locale == "cy" ? ( + <> +

+ Oherwydd gwaith cynnal a chadw + hanfodol, rydym yn disgwyl rhywfaint + o darfu ar ein gwasanaethau Porth + Gwaith Achos rhwng 9-13 Chwefror + 2026.{" "} +

+

+ Ymddiheurwn am yr anghyfleustra. Am + ymholiadau brys yn ystod y cyfnod + hwn, cysylltwch â{" "} + + pedw.gwaithachos@llyw.cymru + +

+ + ) : ( + <> +

+ Due to essential maintenance, we are + expecting some disruption to our + Casework Portal services between + 9-13 February 2026. +

+

+ We apologise for the inconvenience. + For urgent enquries during this time + please contact{" "} + + pedw.casework@gov.wales + +

+ + )} +
+
+
)} -
+ ); } diff --git a/pages/auth/signin.js b/pages/auth/signin.js index c107aa8d..3e50fab2 100644 --- a/pages/auth/signin.js +++ b/pages/auth/signin.js @@ -84,7 +84,9 @@ const SignIn = (props) => {

- {t("auth:auth-page-title")}{" "} + {t( + "auth:auth-page-title", + )}{" "}

@@ -122,7 +124,7 @@ const SignIn = (props) => { htmlFor="email" > {t( - "auth:auth-email-label" + "auth:auth-email-label", )} @@ -142,7 +144,7 @@ const SignIn = (props) => { } > {t( - "auth:auth-signin-button-label" + "auth:auth-signin-button-label", )}
@@ -163,10 +165,10 @@ const SignIn = (props) => { }; export async function getServerSideProps(context) { - if (process.env.SHOWLOGIN == false) { + if (process.env.SHOWLOGIN === "false" || process.env.SHOWLOGIN === false) { return { redirect: { - destination: "/404", + destination: "/status", permanent: false, }, }; @@ -177,7 +179,7 @@ export async function getServerSideProps(context) { "\n//////////////////////\n", "Sign in callbackurl: " + context.query.callbackUrl, context.locale, - "\n//////////////////////\n" + "\n//////////////////////\n", ); let formURL = context.req.headers.host; //console.log("formUrl:", formURL); @@ -207,7 +209,7 @@ export async function getServerSideProps(context) { // Append the query parameters to the new URL params.forEach((value, key) => - toUrlObj.searchParams.append(key, value) + toUrlObj.searchParams.append(key, value), ); return toUrlObj.toString(); // Return the full new URL as a string @@ -216,7 +218,7 @@ export async function getServerSideProps(context) { typeof context.query.callbackUrl != "undefined" && (formURL = appendParamsAndPathToNewUrl( context.query.callbackUrl, - formURL + formURL, )); //formURL = appendParamsAndPathToNewUrl(context.query.callbackUrl, formURL); diff --git a/pages/auth/signin2.js b/pages/auth/signin2.js index 569281e7..b4e703e3 100644 --- a/pages/auth/signin2.js +++ b/pages/auth/signin2.js @@ -236,10 +236,10 @@ export async function getServerSideProps(context) { }; } - if (process.env.SHOWLOGIN == false) { + if (process.env.SHOWLOGIN === "false" || process.env.SHOWLOGIN === false) { return { redirect: { - destination: "/404", + destination: "/status", permanent: false, }, }; @@ -250,7 +250,7 @@ export async function getServerSideProps(context) { "\n//////////////////////\n", "Sign in callbackurl: " + context.req.headers.host, context.locale, - csrfToken + "\n//////////////////////\n" + csrfToken + "\n//////////////////////\n", ); let formURL = context.req.headers.host; console.log("formUrl:", formURL); diff --git a/pages/status.js b/pages/status.js index e59c8e59..17892561 100644 --- a/pages/status.js +++ b/pages/status.js @@ -1,28 +1,93 @@ import useTranslation from "next-translate/useTranslation"; import Head from "next/head"; +import CookieBanner from "../components/cookieBanner"; +import Header from "../components/header"; +import Footer from "../components/footer"; +import router from "next/router"; -const FourOhFour = (props) => { +const StatusPage = (props) => { let { t, lang } = useTranslation(); const { footerLinks, pages } = props; return (
- Status Up + Site Status
+ +
-
-

Status Up

+
+ + + Announcement + + +
+
+

+ {router.locale == "cy" + ? "Cyhoeddiad" + : "Announcement"} +

+
+
+ {router.locale == "cy" ? ( + <> +

+ Oherwydd gwaith cynnal a + chadw hanfodol, rydym yn + disgwyl rhywfaint o darfu ar + ein gwasanaethau Porth + Gwaith Achos rhwng 9-13 + Chwefror 2026.{" "} +

+

+ Ymddiheurwn am yr + anghyfleustra. Am ymholiadau + brys yn ystod y cyfnod hwn, + cysylltwch â{" "} + + pedw.gwaithachos@llyw.cymru + +

+ + ) : ( + <> +

+ Due to essential + maintenance, we are + expecting some disruption to + our Casework Portal services + between 9-13 February 2026. +

+

+ We apologise for the + inconvenience. For urgent + enquries during this time + please contact{" "} + + pedw.casework@gov.wales + +

+ + )} +
+
+
); }; -export default FourOhFour; +export default StatusPage;