|
|
|
@@ -67,6 +67,33 @@ import { FormattedMessage } from "react-intl"; |
|
|
|
|
|
|
|
const drawerWidth = 300; |
|
|
|
|
|
|
|
const ABOUT_SWITCH_DATE = new Date(2026, 0, 27); // 2026-01-28 |
|
|
|
|
|
|
|
const startOfDay = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate()); |
|
|
|
|
|
|
|
// 規則:<= 2026-01-28 用舊 aboutUs;> 2026-01-28 先轉外部 |
|
|
|
const isAfterAboutSwitchDate = () => { |
|
|
|
const today = startOfDay(new Date()); |
|
|
|
const switchDay = startOfDay(ABOUT_SWITCH_DATE); |
|
|
|
return today.getTime() > switchDay.getTime(); // strictly AFTER |
|
|
|
}; |
|
|
|
|
|
|
|
const getAboutExternalUrlByLocale = () => { |
|
|
|
const locale = (localStorage.getItem("locale") || "").toLowerCase(); |
|
|
|
|
|
|
|
if (locale === "zh-hk") { |
|
|
|
// TChinese |
|
|
|
return "https://www.gld.gov.hk/en/our-services/printing/advertising-gov-gazette/"; |
|
|
|
} |
|
|
|
if (locale === "zh-cn") { |
|
|
|
// Simplified Chinese (你未貼,我用 zh-cn 版) |
|
|
|
return "https://www.gld.gov.hk/zh-cn/our-services/printing/advertising-gov-gazette/"; |
|
|
|
} |
|
|
|
// English (en-us) / fallback |
|
|
|
return "https://www.gld.gov.hk/zh-hk/our-services/printing/advertising-gov-gazette/"; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// const navItems = ['Home', 'About', 'Contact']; |
|
|
|
// ==============================|| MAIN LAYOUT - HEADER ||============================== // |
|
|
|
|
|
|
|
@@ -584,12 +611,28 @@ function Header(props) { |
|
|
|
const logoutContent = ( |
|
|
|
<div> |
|
|
|
<li> |
|
|
|
<Link className="login" to={'/aboutUs'}> |
|
|
|
<Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}> |
|
|
|
<FormattedMessage id="aboutUs" /> |
|
|
|
</Typography> |
|
|
|
</Link> |
|
|
|
{!isAfterAboutSwitchDate() ? ( |
|
|
|
// On or before 28/1/2026 |
|
|
|
<Link className="login" to="/aboutUs"> |
|
|
|
<Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}> |
|
|
|
<FormattedMessage id="aboutUs" /> |
|
|
|
</Typography> |
|
|
|
</Link> |
|
|
|
) : ( |
|
|
|
// After 28/1/2026 |
|
|
|
<a |
|
|
|
className="login" |
|
|
|
href={getAboutExternalUrlByLocale()} |
|
|
|
target="_blank" |
|
|
|
rel="noopener noreferrer" |
|
|
|
> |
|
|
|
<Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}> |
|
|
|
<FormattedMessage id="aboutUs" /> |
|
|
|
</Typography> |
|
|
|
</a> |
|
|
|
)} |
|
|
|
</li> |
|
|
|
|
|
|
|
{/* <li> |
|
|
|
<Link className="login" to={'/userGuidePub'}> |
|
|
|
<Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}> |
|
|
|
|