Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
tsubik committed Jun 12, 2024
2 parents 23405c5 + f938dde commit 9b159a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: wri/fti_api
ref: feature/newsletter-history
ref: master
path: otp_api

- name: Save OTP API Commit SHA
Expand Down
11 changes: 6 additions & 5 deletions pages/newsletter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import API from 'services/api';

const JSONA = new Jsona();

const Newsletter = ({ url, newsletters }) => {
const Newsletter = ({ url, newsletters, language }) => {
const intl = useIntl();

return (
Expand Down Expand Up @@ -47,7 +47,7 @@ const Newsletter = ({ url, newsletters }) => {
// genereate newsletter card with image on top and title and description below
<div key={newsletter.id} className="newsletter-card">
<a href={newsletter.attachment.url}>
<div className="newsletter-card__image" style={{ backgroundImage: `url(${newsletter.image.thumbnail.url})` }} />
<div className="newsletter-card__image" style={{ backgroundImage: `url(${newsletter.image.url})` }} />
</a>
<div className="newsletter-card__content">
<h3>
Expand All @@ -56,7 +56,7 @@ const Newsletter = ({ url, newsletters }) => {
</a>
</h3>
<small className="newsletter-card__date">
{new Date(newsletter.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', timeZone: 'UTC' })}
{new Date(newsletter.date).toLocaleDateString(language, { year: 'numeric', month: 'long', timeZone: 'UTC' })}
</small>
<p>{newsletter["short-description"]}</p>
</div>
Expand All @@ -77,15 +77,16 @@ const Newsletter = ({ url, newsletters }) => {

Newsletter.propTypes = {
url: PropTypes.shape({}).isRequired,
newsletters: PropTypes.array.isRequired
newsletters: PropTypes.array.isRequired,
language: PropTypes.string.isRequired
};
Newsletter.getInitialProps = async ({ url, store }) => {
const { language } = store.getState();
const newsletters = await API
.get('newsletters', { locale: language })
.then((response) => JSONA.deserialize(response));

return { url, newsletters };
return { url, newsletters, language };
}


Expand Down

0 comments on commit 9b159a5

Please sign in to comment.