Skip to content

Commit

Permalink
Added site localisation for title, header and footer text, and for th…
Browse files Browse the repository at this point in the history
…e main icon
  • Loading branch information
paolo7 committed May 1, 2024
1 parent 96ce25a commit 2e97afb
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 7 deletions.
25 changes: 24 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,30 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>TMH Registry</title>
<title>eRegistry</title>
<script>
window.onload = function() {
var domain = window.location.hostname;
var title = "eRegistry";
if (window.location.hostname === 'tmh-registry-client.herokuapp.com') {
// Tanzania
title = "eRegistry Tz";
} else if (window.location.hostname === 'tmh-registry-client-gh-6a64e51863f6.herokuapp.com') {
// Ghana
title = "eRegistry Gh";
} else if (window.location.hostname === 'tmh-registry-client-sl.herokuapp.com') {
// Sierra Leone
title = "eRegistry SL";
} else if (window.location.hostname === 'tmh-registry-client-staging.herokuapp.com') {
// Staging site
title = "eRegistry TEST SITE";
} else if (window.location.hostname === 'localhost') {
// Localhost
title = "eRegistry LOCALHOST";
}
document.title = title;
};
</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Binary file added src/assets/gh-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/assets/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import GHLogo from 'assets/gh-logo.png'
import SLLogo from 'assets/sl-logo.png';
import SwiftSSLogo from 'assets/swiftss-logo.png';
import TSALogoLocal from 'assets/tsa-logo-local.png';
import TSALogoTest from 'assets/tsa-logo-test.png';
import TSALogo from 'assets/tsa-logo.png';

export default {
GHLogo,
SLLogo,
TSALogo,
SwiftSSLogo,
TSALogoLocal,
TSALogoTest,
};
Binary file added src/assets/sl-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tsa-logo-local.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tsa-logo-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 118 additions & 6 deletions src/components/Drawer/Drawer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React from 'react';

import { Button, useBreakpoints } from '@orfium/ictinus';
import GHLogo from 'assets/gh-logo.png'
import SLLogo from 'assets/sl-logo.png';
import SwiftSSLogo from 'assets/swiftss-logo.png';
import TSALogoLocal from 'assets/tsa-logo-local.png';
import TSALogoTest from 'assets/tsa-logo-test.png';
import TSALogo from 'assets/tsa-logo.png';
import { useHistory } from 'react-router-dom';

import SwiftSSLogo from '../../assets/swiftss-logo.png';
import TSALogo from '../../assets/tsa-logo.png';
import { useIsLoggedIn } from '../../hooks/useIsLoggedIn';
import urls from '../../routing/urls';
import { clearUserStorage } from '../../utils/storage';
Expand All @@ -29,6 +33,25 @@ export type Props = {
handleClick?: () => void;
};

let SiteLogo: string;
SiteLogo = TSALogo;
if (window.location.hostname === 'tmh-registry-client.herokuapp.com') {
// Tanzania
SiteLogo = TSALogo;
} else if (window.location.hostname === 'tmh-registry-client-gh-6a64e51863f6.herokuapp.com') {
// Ghana
SiteLogo = GHLogo;
} else if (window.location.hostname === 'tmh-registry-client-sl.herokuapp.com') {
// Sierra Leone
SiteLogo = SLLogo;
} else if (window.location.hostname === 'tmh-registry-client-staging.herokuapp.com') {
// Staging site
SiteLogo = TSALogoTest;
} else if (window.location.hostname === 'localhost') {
// Localhost
SiteLogo = TSALogoLocal;
}

const Drawer: React.FC<Props> = (props) => {
const breakpoints = useBreakpoints();
const isSmallDesktop = breakpoints.des1200 && !breakpoints.des1440;
Expand All @@ -52,6 +75,96 @@ const Drawer: React.FC<Props> = (props) => {
const isDesktop =
breakpoints.des1200 || breakpoints.des1440 || breakpoints.des1366 || breakpoints.des1920;

const getLocalisedFooterText = () => {
if (window.location.hostname === 'tmh-registry-client.herokuapp.com') {
// Tanzania
return (
<div>The Tanzania National Mesh Hernia Project is an original collaboration between SWIFTSS
and the TSA (and the forerunner of the Affordable Mesh Hernia Surgery Initiative). For
more information visit <a href="https://swiftss.org/">www.swiftss.org</a>.</div>
);
} else if (window.location.hostname === 'tmh-registry-client-gh-6a64e51863f6.herokuapp.com') {
// Ghana
return (
<div>The Affordable Mesh Hernia Surgery Initiative is a collaboration between SWIFTSS and
the Ghanaian AMHSI working group. For more information visit
<a href="https://swiftss.org/">www.swiftss.org</a>.</div>
);
} else if (window.location.hostname === 'tmh-registry-client-sl.herokuapp.com') {
// Sierra Leone
return (
<div>The Affordable Mesh Hernia Surgery Initiative is a collaboration between SWIFTSS and
the Sierra Leone AMHSI working group. For more information visit
<a href="https://swiftss.org/">www.swiftss.org</a>.</div>
);
} else if (window.location.hostname === 'tmh-registry-client-staging.herokuapp.com') {
// Staging site
return (
<div>This is the test site for the AMHSI. Please enjoy the freedom to try it out. Look
around and create some fake patients, episodes, discharges and follow ups. PLEASE DO NOT
USE ANY REAL DATA ON THIS SITE.</div>
);
} else if (window.location.hostname === 'localhost') {
// Localhost
return (
<div>The Tanzania National Mesh Hernia Project is an original collaboration between SWIFTSS
and the TSA (and the forerunner of the Affordable Mesh Hernia Surgery Initiative). For
more information visit <a href="https://swiftss.org/">www.swiftss.org</a>. LOCALHOST</div>
)
} else {
return (
<div>The Tanzania National Mesh Hernia Project is an original collaboration between SWIFTSS
and the TSA (and the forerunner of the Affordable Mesh Hernia Surgery Initiative). For
more information visit <a href="https://swiftss.org/">www.swiftss.org</a>.</div>
);
}
};

const footerText= getLocalisedFooterText();

const getLocalisedHeaderText = () => {
if (window.location.hostname === 'tmh-registry-client.herokuapp.com') {
// Tanzania
return (
<div>Tanzania National <br />
Mesh Hernia Project <br />
eRegistry</div>
);
} else if (window.location.hostname === 'tmh-registry-client-gh-6a64e51863f6.herokuapp.com') {
// Ghana
return (
<div>AMHSI Ghana <br />
eRegistry</div>
);
} else if (window.location.hostname === 'tmh-registry-client-sl.herokuapp.com') {
// Sierra Leone
return (
<div>AMHSI Sierra Leone <br />
eRegistry</div>
);
} else if (window.location.hostname === 'tmh-registry-client-staging.herokuapp.com') {
// Staging site
return (
<div>AMHSI <br />
TEST SITE</div>
);
} else if (window.location.hostname === 'localhost') {
// Localhost
return (
<div>eRegistry <br />
LOCALHOST SITE</div>
)
} else {
return (
<div>Tanzania National <br />
Mesh Hernia Project <br />
eRegistry</div>
);
}
};

const headerText= getLocalisedHeaderText();

return (
<Container
expanded={props.expanded}
Expand Down Expand Up @@ -84,20 +197,19 @@ const Drawer: React.FC<Props> = (props) => {
</UserContainer>
)}
<HeaderText>
Tanzania <br />
NMHP Registry
{headerText}
</HeaderText>
</Header>
<Navigation handleClick={handleClick} {...props} />

<Footer>
<div style={{ display: 'flex', gap: '12px' }}>
<img width={44} src={SwiftSSLogo} />
<img width={52} src={TSALogo} />
<img width={52} src={SiteLogo} />
</div>

<FooterText>
The Tanzania Mesh Hernia Project Registry is a joint project between Swiftss and the TSA.
{footerText}
</FooterText>
</Footer>
</Container>
Expand Down

0 comments on commit 2e97afb

Please sign in to comment.