Skip to content

Commit

Permalink
csv content
Browse files Browse the repository at this point in the history
  • Loading branch information
mluena committed Sep 24, 2024
1 parent eb4ee34 commit 8eb27c3
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 114 deletions.
39 changes: 0 additions & 39 deletions client/src/components/forms/dataset/controls.tsx

This file was deleted.

62 changes: 62 additions & 0 deletions client/src/components/new-dataset/step-description/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
export const PROJECTS_CSV_CONTENT = {
title: "Project/s",
columns: [
"name",
"status",
"objective",
"amount",
"countries",
"source_country",
"sdgs",
"pillar",
"organization_type",
"info",
"funding",
],
examples: [
"Import test 1, In Execution, Seeking Collaborative Partnerships, 120000, Jamaica; Bahamas; Belize, The United States, SDG 12 - Responsible production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 1.5% New Green Jobs for Physical & Economic Resilience, For-profit, example info 1, Grant",
"Import test 2, Completed, Building Public Awareness and Engagement, 120001, Trinidad and Tobago; Belize, Trinidad & Tobago, SDG 7 - Affordable and clean energy; SDG 8 - Decent work and economic growth; SDG 9 - Industry Innovation and Infrastructure; SDG 11 - Sustainable Cities and Communities; SDG 12 - Responsible production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for All, For-profit, example info 2, Loan",
"Import test 3, Start-up to Early Stage, An Opportunity to Scale to New jurisdictions, 120002, Belize; Bahamas, Belize, SDG 7 - Affordable and clean energy; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for All, For-profit, example info 3, Venture Capital",
"Import test 4, Start-up to Early Stage, Attracting Investment and Securing Funding, 120003, Bahamas, Barbados, SDG 7 - Affordable and clean energy; SDG 8 - Decent work and economic growth; SDG 9 - Industry Innovation and Infrastructure; SDG 11 - Sustainable Cities and Communities; SDG 12 - Responsible production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for All, For-profit, example info 3, Venture Debt",
],
};

export const OTHER_TOOLS_CSV_CONTENT = {
title: "Other Tools",
columns: ["name", "link", "category", "description"],
categories: [
"Biodiversity",
"Blue Economy",
"Climate Impacts",
"Conservation",
"Data",
"Energy",
"General",
"Trade",
"Vulnerability",
],
examples: [
"Tool A, http://example.com, Data, A tool for data analysis and visualization.",
"Tool B, http://example2.com, Climate Impacts, A tool for assessing climate impacts.",
],
};

export const COLLABORATORS_CSV_CONTENT = {
title: "Collaborators",
columns: ["name", "type", "link"],
examples: [
"John Doe, Donor, http://university.edu",
"Jane Smith, Collaborator, http://company.com",
],
};

export const LINK_CSV_CONTENT = {
title: "Link",
columns: ["country_id", "link_title", "link_url", "description"],
examples: [
"AIA, Title 1, http://example1.com, Description 1",
"AIA, Title 2, http://example2.com, Description 2",
"MEX, Title 3, http://example3.com, Description 3",
"VIR, Title 4, http://example4.com, Description 4",
],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { CSVImportTypes } from "./types";

import {
PROJECTS_CSV_CONTENT,
OTHER_TOOLS_CSV_CONTENT,
COLLABORATORS_CSV_CONTENT,
LINK_CSV_CONTENT,
} from "./constants";

export default function CSVInfoContent({ valueType }: { valueType: CSVImportTypes }) {
return (
<div className="space-y-5 p-5">
Expand Down Expand Up @@ -68,11 +75,11 @@ export default function CSVInfoContent({ valueType }: { valueType: CSVImportType

{valueType === "resource" && (
<div className="text-sm">
<h4 className="font-metropolis tracking-tight">Link</h4>
<h4 className="font-metropolis tracking-tight">{LINK_CSV_CONTENT.title}</h4>
<div className="space-y-2.5">
<p>
<span className="font-semibold">Columns:</span>{" "}
<code>country_id, link_title, link_url, description</code>.
<code>{LINK_CSV_CONTENT.columns.join(", ")}</code>.
</p>
<p>
Where <code>country_id</code> refers to the ISO3 country code, <code>link_title</code>{" "}
Expand All @@ -83,128 +90,84 @@ export default function CSVInfoContent({ valueType }: { valueType: CSVImportType
</p>
<p className="font-semibold">Example:</p>
<div className="flex flex-col bg-gray-100 p-4">
<code>country_id, link_title, link_url, description</code>
<code>AIA, Example, http://example.com, link description</code>
<code>{LINK_CSV_CONTENT.columns.join(", ")}</code>
<code>{LINK_CSV_CONTENT.examples[0]}</code>
</div>
<p>
If there are multiple resources for a single country, the CSV should look like this:
</p>
<div className="flex flex-col bg-gray-100 p-4">
<code>country_id, link_title, link_url, description</code>

<code>AIA, Title 1, http://example1.com, Description 1</code>

<code>AIA, Title 2, http://example2.com, Description 2</code>

<code>MEX, Title 3, http://example3.com, Description 3</code>

<code>VIR, Title 4, http://example4.com, Description 4</code>
{LINK_CSV_CONTENT.columns.join(", ")}
{LINK_CSV_CONTENT.examples.map((example) => (
<code key={example}>{example}</code>
))}
</div>
</div>
</div>
)}

{valueType === "project" && (
<div className="text-sm">
<h4 className="font-metropolis tracking-tight">Project/s</h4>
<h4 className="font-metropolis tracking-tight">{PROJECTS_CSV_CONTENT.title}</h4>
<div className="space-y-2.5">
<p>
<span className="font-semibold">Columns:</span>{" "}
<code>
name, highlight, status, objective, amount, countries, source_country, sdgs, pillar,
organization_type, info, funding
</code>
.
<code>{PROJECTS_CSV_CONTENT.columns.join(", ")}</code>.
</p>
<p className="font-semibold">Example:</p>
<div className="flex flex-col bg-gray-100 p-4">
<code>
name, highlight, status, objective, amount, countries, source_country, sdgs, pillar,
organization_type, info, funding
</code>
<code>
Import test 1, Highlight 1, In Execution, This project has been delivered, 120000,
Jamaica; Bahamas; Belize, The United States, SDG 12 - Responsible production and
consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 1.5% New
Green Jobs for Physical & Economic Resilience, For-profit, ,
</code>
<code>
Import test 2, Highlight 2, Completed, This project has been delivered, 120001,
Trinidad and Tobago; Belize, Trinidad & Tobago, SDG 7 - Affordable and clean energy;
SDG 8 - Decent work and economic growth; SDG 9 - Industry Innovation and
Infrastructure; SDG 11 - Sustainable Cities and Communities; SDG 12 - Responsible
production and consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the
goals, 90% Renewable Energy for All, For-profit, ,
</code>
<code>
Import test 3, Highlight 3, Start-up to Early Stage, This project has been
delivered, 120002, Belize; Bahamas, Belize, SDG 7 - Affordable and clean energy; SDG
13 - Climate Action; SDG 17 - Partnership for the goals, 90% Renewable Energy for
All, For-profit, ,
</code>
<code>
Import test 4, Highlight 4, Start-up to Early Stage, This project has been
delivered, 120003, Bahamas, Barbados, SDG 7 - Affordable and clean energy; SDG 8 -
Decent work and economic growth; SDG 9 - Industry Innovation and Infrastructure; SDG
11 - Sustainable Cities and Communities; SDG 12 - Responsible production and
consumption; SDG 13 - Climate Action; SDG 17 - Partnership for the goals, 90%
Renewable Energy for All, For-profit, ,
</code>
<div className="flex flex-col space-y-2 bg-gray-100 p-4">
<code>{PROJECTS_CSV_CONTENT.columns.join(", ")}</code>
{PROJECTS_CSV_CONTENT.examples.map((example) => (
<code key={example}>{example}</code>
))}
</div>
</div>
</div>
)}

{valueType === "other-tools" && (
<div className="text-sm">
<h4 className="font-metropolis tracking-tight">Other Tools</h4>
<h4 className="font-metropolis tracking-tight">{OTHER_TOOLS_CSV_CONTENT.title}</h4>
<div className="space-y-2.5">
<p>
<span className="font-semibold">Columns:</span>{" "}
<code>name, link, category, description</code>.
<code>{OTHER_TOOLS_CSV_CONTENT.columns.join(", ")}</code>.
</p>
<p className="font-semibold">Categories:</p>
<ul className="ml-5 list-disc">
<li>Biodiversity</li>
<li>Blue Economy</li>
<li>Climate Impacts</li>
<li>Conservation</li>
<li>Data</li>
<li>Energy</li>
<li>General</li>
<li>Trade</li>
<li>Vulnerability</li>
{OTHER_TOOLS_CSV_CONTENT.categories.map((category) => (
<li key={category}>{category}</li>
))}
</ul>
<p className="font-semibold">Example:</p>
<div className="flex flex-col bg-gray-100 p-4">
<code>name, link, category, description</code>
<code>
Tool A, http://example.com, Data, A tool for data analysis and visualization.
</code>
<code>
Tool B, http://example2.com, Climate Impacts, A tool for assessing climate impacts.
</code>
<code>{OTHER_TOOLS_CSV_CONTENT.columns.join(", ")}</code>
{OTHER_TOOLS_CSV_CONTENT.examples.map((example) => (
<code key={example}>{example}</code>
))}
</div>
</div>
</div>
)}

{valueType === "collaborators" && (
<div className="text-sm">
<h4 className="font-metropolis tracking-tight">Collaborators</h4>
<h4 className="font-metropolis tracking-tight">{COLLABORATORS_CSV_CONTENT.title}</h4>
<div className="space-y-2.5">
<p>
<span className="font-semibold">Columns:</span> <code>name, type, link</code>.
<span className="font-semibold">Columns:</span>{" "}
<code>{COLLABORATORS_CSV_CONTENT.columns.join(", ")}</code>.
</p>
<p>
<span className="font-semibold">Type:</span> The type field should be either{" "}
<code>Donor</code> or <code>Collaborator</code>.
</p>
<p className="font-semibold">Example:</p>
<div className="flex flex-col bg-gray-100 p-4">
<code>name, type, link</code>
<code>John Doe, Donor, http://university.edu</code>
<code>Jane Smith, Collaborator, http://company.com</code>
<code>{COLLABORATORS_CSV_CONTENT.columns.join(", ")}</code>
{COLLABORATORS_CSV_CONTENT.examples.map((example) => (
<code key={example}>{example}</code>
))}
</div>
</div>
</div>
Expand Down

0 comments on commit 8eb27c3

Please sign in to comment.