Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new category tags #60

Merged
merged 1 commit into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions pages/datasets/[explorer]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ import {
filter_data_budgettype,
fetchFromTags,
datasetPopulation,
categoryTag,
} from "utils";
import {
Download,
ArrowForward,
ExternalLink,
} from "components/icons/ListingIcons";
import { Download, ExternalLink } from "components/icons/ListingIcons";
import Indicator from "components/analytics/Indicator";
import Modal from "react-modal";
import SimpleBarLineChartViz from "components/viz/SimpleBarLineChart";
Expand Down Expand Up @@ -114,12 +111,6 @@ const Analysis: React.FC<Props> = ({ data, meta, fileData, allData }) => {
"Actual Expenditure",
];

const prData = [
"Actual Expenditure as a % of Total Actual Expenditure",
"Actual Expenditure as a % of Ministry",
"Fund Utilisation",
];

const vizItems = [
{
id: "barGraph",
Expand Down Expand Up @@ -334,6 +325,7 @@ const Analysis: React.FC<Props> = ({ data, meta, fileData, allData }) => {
<p>{data.notes}</p>
<div className="explorer__meta ">
{meta["Type of Scheme"] && <span>{meta["Type of Scheme"]}</span>}
{<span>{categoryTag(data.tags)}</span>}
</div>
</section>
</div>
Expand Down
9 changes: 9 additions & 0 deletions utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ import {
Police,
HomeAffairs,
} from "components/icons/ListingIcons";

export function categoryIcon(tags) {
if (tags.includes("law")) return <LawJustice />;
else if (tags.includes("wcd")) return <WomenChild />;
else if (tags.includes("police")) return <Police />;
else return <HomeAffairs />;
}

export function categoryTag(tags) {
if (tags.includes("law")) return "Ministry of Law & Justice";
else if (tags.includes("wcd"))
return "Ministry of Women & Child Development";
else if (tags.includes("police")) return "Department of Police";
else return "Ministry of Home Affairs";
}

export function stripTitle(name) {
const shortName = name.includes("data for the")
? name.split("data for the ")[1]
Expand Down