Skip to content

Commit

Permalink
Add Footer and Map in home page
Browse files Browse the repository at this point in the history
  • Loading branch information
barshathakuri committed Mar 27, 2024
1 parent 6af0194 commit a6aacf0
Show file tree
Hide file tree
Showing 32 changed files with 2,109 additions and 112 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- 'develop'

env:
APP_MAPBOX_ACCESS_TOKEN: ${{ vars.APP_MAPBOX_ACCESS_TOKEN }}
GITHUB_WORKFLOW: true

jobs:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
ui
node_modules
dist
dist-ssr
Expand Down
1 change: 1 addition & 0 deletions env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import { defineConfig, Schema } from '@julr/vite-plugin-validate-env';

export default defineConfig({
APP_TITLE: Schema.string.optional(),
APP_MAPBOX_ACCESS_TOKEN: Schema.string(),
})
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
"@togglecorp/re-map": "^0.1.4",
"@turf/bbox": "^6.5.0",
"graphql": "^16.8.1",
"mapbox-gl": "^1.13.0",
"mapbox-gl": "^3.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3"
},
"devDependencies": {
"@eslint/eslintrc": "^3.0.2",
"@julr/vite-plugin-validate-env": "^1.0.1",
"@types/mapbox-gl": "^1.13.0",
"@types/node": "^20.11.30",
"@types/react": "^18.2.70",
"@types/mapbox-gl": "^3.1.0",
"@types/node": "^20.1.3",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.2.22",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^7.4.0",
Expand Down
4 changes: 4 additions & 0 deletions src/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import {
createBrowserRouter,
RouterProvider,
} from 'react-router-dom';
import mapboxgl from 'mapbox-gl';

import { mbtoken } from '#config';

import { unwrappedRoutes } from './routes';

const router = createBrowserRouter(unwrappedRoutes);
mapboxgl.accessToken = mbtoken;

function App() {
return (
Expand Down
4 changes: 4 additions & 0 deletions src/App/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@ export const wrappedRoutes = {
};

export const unwrappedRoutes = unwrapRoute(Object.values(wrappedRoutes));

export default wrappedRoutes;

export type WrappedRoutes = typeof wrappedRoutes;
5 changes: 3 additions & 2 deletions src/assets/icons/go-logo-2020.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/components/GlobalFooter/i18n.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"namespace": "common",
"strings": {
"footerAboutAlertHub":"About Alert Hub",
"footerAboutAlertHubDesc":"The aim of IFRC Alert Hub is to provide timely and effective emergency alerts to communities worldwide, empowering them to protect their lives and livelihoods.",
"footerFindOutMore":"Find out more",
"footerHelpfulLinks":"Helpful links",
"footerOpenSourceCode":"Open Source Code",
"footerApiDocumentation":"API Documentation",
"footerOtherResources":"Other Resources",
"footerContactUs":"Contact Us",
"footerIFRC":"© IFRC {year} v{appVersion}",
"globalFindOut": "Find Out More",
"globalHelpfulLinks": "Helpful links"
}
}
132 changes: 132 additions & 0 deletions src/components/GlobalFooter/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import { Link } from 'react-router-dom';
import {
Heading,
PageContainer,
} from '@ifrc-go/ui';
import { useTranslation } from '@ifrc-go/ui/hooks';
import { resolveToComponent } from '@ifrc-go/ui/utils';
import { _cs } from '@togglecorp/fujs';

import {
appCommitHash,
appVersion,
} from '#config';

import i18n from './i18n.json';
import styles from './styles.module.css';

const date = new Date();
const year = date.getFullYear();

interface Props {
className?: string;
}

function GlobalFooter(props: Props) {
const {
className,
} = props;

const strings = useTranslation(i18n);
const copyrightText = resolveToComponent(
strings.footerIFRC,
{
year,
appVersion: (
<span title={appCommitHash}>
{appVersion}
</span>
),
},
);

return (
<PageContainer
className={_cs(styles.footer, className)}
contentClassName={styles.content}
containerAs="footer"
>
<div className={styles.section}>
<Heading>
{strings.footerAboutAlertHub}
</Heading>
<div className={styles.description}>
{strings.footerAboutAlertHubDesc}
</div>
<div className={styles.copyright}>
{copyrightText}
</div>
</div>
<div className={styles.section}>
<Heading>
{strings.globalFindOut}
</Heading>
<div className={styles.subSection}>
<Link
className={styles.footerLink}
to="https://ifrc.org"
target="_blank"
>
ifrc.org
</Link>
<Link
className={styles.footerLink}
to="https://rcrcsims.org"
target="_blank"
>
rcrcsims.org
</Link>
<Link
className={styles.footerLink}
to="https://data.ifrc.org"
target="_blank"
>
data.ifrc.org
</Link>
</div>
</div>
<div className={styles.section}>
<Heading>
{strings.globalHelpfulLinks}
</Heading>
<div className={styles.subSection}>
<Link
className={styles.footerLink}
to="https://github.com/IFRCGo/alert-hub-web-app"
target="_blank"
>
{strings.footerOpenSourceCode}
</Link>
<Link
className={styles.footerLink}
to="https://github.com/IFRC-Alert-Hub/Alert-Hub-Alert-Manager#api-documentation"
target="_blank"
>
{strings.footerApiDocumentation}
</Link>
{/* // FIXME: Add Resource route */}
<Link
className={styles.footerLink}
to="/"
target="_blank"
>
{strings.footerOtherResources}
</Link>
</div>
</div>
<div className={styles.section}>
<Heading>
{strings.footerContactUs}
</Heading>
<Link
className={styles.contactButton}
to="mailto:[email protected]"
>
[email protected]
</Link>
</div>
</PageContainer>
);
}

export default GlobalFooter;
53 changes: 53 additions & 0 deletions src/components/GlobalFooter/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.footer {
background-color: var(--go-ui-color-primary-gray);
color: var(--go-ui-color-white);

.content {
display: flex;
gap: var(--go-ui-spacing-2xl);
flex-wrap: wrap;

.section {
display: flex;
flex-basis: 12rem;
flex-direction: column;
flex-grow: 1;
gap: var(--go-ui-spacing-lg);

.sub-section {
display: flex;
flex-direction: column;
gap: var(--go-ui-spacing-sm);

.footer-link {
text-decoration: none;
color: var(--go-ui-color-white);
font-weight: var(--go-ui-font-weight-medium);
}

.footer-link:hover {
text-decoration: underline;
color: var(--go-ui-color-red-hover);
}
}

.contact-button {
border-radius: var(--go-ui-border-radius-2xl);
background-color: var(--go-ui-color-primary-red);
padding: var(--go-ui-spacing-2xs) var(--go-ui-spacing-xl);
width: fit-content;
text-decoration: none;
color: var(--go-ui-color-white);
font-weight: var(--go-ui-font-weight-medium);
}

.contact-button:hover {
text-decoration: underline;
}
}
}

@media print {
display: none;
}
}
4 changes: 3 additions & 1 deletion src/components/Navbar/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"headerLogoAltText": "Alert Hub logo",
"appLogin": "Login",
"appAbout": "About",
"appResources": "Resources"
"appResources": "Resources",
"headerMenuHome": "Home",
"headerMenuMySubscription": "My Subscription"
}
}
26 changes: 25 additions & 1 deletion src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Link } from 'react-router-dom';
import {
Button,
Heading,
NavigationTabList,
PageContainer,
} from '@ifrc-go/ui';
Expand Down Expand Up @@ -32,12 +33,20 @@ function Navbar(props: Props) {
contentClassName={styles.topContent}
>
<div className={styles.brand}>
<Link to="home">
<Link
className={styles.alertHubTitle}
to="home"
>
<img
className={styles.goIcon}
src={goLogo}
alt={strings.headerLogoAltText}
/>
<Heading
level={2}
>
ALERT HUB
</Heading>
</Link>
</div>
<NavigationTabList
Expand Down Expand Up @@ -66,6 +75,21 @@ function Navbar(props: Props) {
</Button>
</NavigationTabList>
</PageContainer>
<PageContainer
contentClassName={styles.bottom}
>
<NavigationTabList
className={styles.menuItem}
variant="tertiary"
>
<Link
to="/"
className={styles.menuItem}
>
{strings.headerMenuHome}
</Link>
</NavigationTabList>
</PageContainer>
</nav>
);
}
Expand Down
Loading

0 comments on commit a6aacf0

Please sign in to comment.