Skip to content

Commit

Permalink
Merge pull request #10 from OpenUpSA/feature/references
Browse files Browse the repository at this point in the history
Added references to scenarios and the references pafgfe
  • Loading branch information
paulmwatson authored Sep 4, 2024
2 parents 20ec59c + 0e460b4 commit fc7b6b2
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 12 deletions.
18 changes: 18 additions & 0 deletions app/[locale]/references/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,32 @@
import { useTranslations } from "next-intl";
import { Link } from "app/[locale]/navigation";

import { ReferencesList } from "components/referencesList";
import { Key } from "react";

export default function Page() {
const t = useTranslations("global");
const tP = useTranslations("references");
const scenarios = t.raw("scenarios");

return (
<>
<h1>{tP("title")}</h1>
<h2>{tP("sub-title")}</h2>
{scenarios.map((scenario: any, index: number) => (
<>
{scenario.references && (
<>
<h3>
{t("scenario-count")}
{index + 1}
</h3>
<ReferencesList references={scenario.references} />
</>
)}
</>
))}

<Link
href={`/debrief`}
className="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded"
Expand Down
8 changes: 7 additions & 1 deletion app/[locale]/scenarios/[slug]/[answer]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslations } from "next-intl";
import { redirect } from "next/navigation";
import { Link } from "app/[locale]/navigation";

//import scenarios from "../../../../data/scenarios.json";
import { ReferencesList } from "components/referencesList";

export default function Page({
params,
Expand Down Expand Up @@ -53,6 +53,12 @@ export default function Page({
{t("finish")}
</Link>
)}
{scenario.references && (
<>
<h3>{t("references")}</h3>
<ReferencesList references={scenario.references} />
</>
)}
</>
);
}
9 changes: 8 additions & 1 deletion app/[locale]/scenarios/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { useTranslations } from "next-intl";
import { redirect } from "next/navigation";
import { Link } from "app/[locale]/navigation";
import Image from "next/image";

import { Key } from "react";

import { ReferencesList } from "components/referencesList";

export default function Page({
params,
}: {
Expand Down Expand Up @@ -93,6 +94,12 @@ export default function Page({
{t("next-scenario")}
</Link>
)}
{!scenario.options && scenario.references && (
<>
<h3>{t("references")}</h3>
<ReferencesList references={scenario.references} />
</>
)}
</>
);
}
20 changes: 20 additions & 0 deletions components/referencesList/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use client";

import { Key } from "react";

export function ReferencesList({ references }: { references: any }) {
return (
<ol className="list-decimal">
{references.map(
(reference: { title: string; url: string }, index: Key) => (
<li key={index}>
{reference.title && <>{reference.title}, </>}
<a href={reference.url} target="_blank">
{reference.url}
</a>
</li>
)
)}
</ol>
);
}
43 changes: 33 additions & 10 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"scenario-count": "Scenario ",
"next-scenario": "Next scenario",
"finish": "Finish!",
"references": "References",
"scenarios": [
{
"format": "normal",
Expand Down Expand Up @@ -110,7 +111,17 @@
"title": "Are you sure you are cut out for this business?",
"description": "PetroSA seemingly handed over several early payments to Imvume Management, a company which was later accused by an independent inquiry of illicit dealing under the oil-for-food programme in Iraq - and it did so, apparently, with the government&apos;s blessing. At least R11m of the money paid from PetroSA was alleged to have ended up going back to the ANC to fund its 2004 election campaign. Here&apos;s the real kicker - most of the Iraqi oil never actually came to SA, and you ended up buying from Russia instead! Start as you mean to go on."
}
}
},
"references": [
{
"title": "Mail & Guardian",
"url": "https://mg.co.za/article/2005-07-15-oilgate-company-was-anc-front/"
},
{
"title": "Volker Report (UN)",
"url": "https://web.archive.org/web/20130823070841/http://www.iic-offp.org/documents/IIC%20Final%20Report%2027Oct2005.pdf"
}
]
},
{
"format": "bonus",
Expand Down Expand Up @@ -142,16 +153,20 @@
"image": "climate-smart-is-economy-smart.png"
}
],
"answers": {
"correct": {
"title": "You handed over the cash, well done!",
"description": "PetroSA seemingly handed over several early payments to Imvume Management, a company which was later accused by an independent inquiry of illicit dealing under the oil-for-food programme in Iraq - and it did so, apparently, with the government&apos;s blessing. At least R11m of the money paid from PetroSA was alleged to have ended up going back to the ANC to fund its 2004 election campaign. Here&apos;s the real kicker - most of the Iraqi oil never actually came to SA, and you ended up buying from Russia instead! Start as you mean to go on."
"references": [
{
"url": "https://www.iol.co.za/business-report/economy/petrosa-eyes-gtl-projects-in-egypt-colombia-and-qatar-734990"
},
"incorrect": {
"title": "Are you sure you are cut out for this business?",
"description": "PetroSA seemingly handed over several early payments to Imvume Management, a company which was later accused by an independent inquiry of illicit dealing under the oil-for-food programme in Iraq - and it did so, apparently, with the government&apos;s blessing. At least R11m of the money paid from PetroSA was alleged to have ended up going back to the ANC to fund its 2004 election campaign. Here&apos;s the real kicker - most of the Iraqi oil never actually came to SA, and you ended up buying from Russia instead! Start as you mean to go on."
{
"url": "https://www.iol.co.za/business-report/companies/petrosa-lands-exploration-rights-in-egypts-gulf-of-suez-732286"
},
{
"url": "https://egyptoil-gas.com/news/petrosa-withdraws-from-the-egyptian-sector/"
},
{
"url": "https://www.imf.org/en/Countries/MOZ"
}
}
]
},
{
"format": "normal",
Expand Down Expand Up @@ -190,7 +205,15 @@
"title": "Are you sure you are cut out for this business?",
"description": "Ipsum doler sit amet adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Start as you mean to go on."
}
}
},
"references": [
{
"url": "https://www.petroleumafrica.com/petrosa-faces-legal-action/"
},
{
"url": "https://www.iol.co.za/news/south-africa/petrosa-taken-to-court-over-r40m-deal-489309"
}
]
},
{
"format": "no-correct-incorrect",
Expand Down

0 comments on commit fc7b6b2

Please sign in to comment.