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

third party UI side drawer improvements #103

Merged
merged 2 commits into from
Mar 6, 2021
Merged
Changes from 1 commit
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
Next Next commit
third party UI side drawer improvements
  • Loading branch information
NONstiky committed Mar 6, 2021
commit 443b0ab6558a2736535b9172b56a98a09b8a867a
47 changes: 35 additions & 12 deletions components/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,44 @@ class Map extends Component {

const thirdPartyPopup = (org) => {
const columns = {
category: "Category",
position: "Position",
comment: "Comment",
};
console.log(org);
var subOrgsByCategory = {};
for(let subOrg in org.subOrgs){
subOrg = org.subOrgs[subOrg];
console.log(subOrg);
console.log("category: " , subOrg[columns.category]);
if(subOrg[columns.category] in subOrgsByCategory){
subOrgsByCategory[subOrg[columns.category]].push(subOrg);
}else{
subOrgsByCategory[subOrg[columns.category]] = [subOrg];
}
}
console.log(subOrgsByCategory);
return `
<span>
<strong>${org.properties.index}</strong>
<div>Sub Orgs</div>
${(org.subOrgs || [])
.map((org) => {
return `<div>
<strong>${org.Name}</strong>
<div>Position: ${org[columns.position]}</div>
<div>Comment: ${org[columns.comment]}</div>
</div>
<br />`;
<center><h3><strong>${org.properties.index}</strong></h3></center>
<div><h3>Sub Organizations</h3></div>
${(Object.keys(subOrgsByCategory))
.map((category) => {
return `<strong><u>${category}s</u></strong>

${subOrgsByCategory[category].map((subOrg)=>{
const color = subOrg[columns.position] == "Endorse" ? "green" : "red";
const checkOrX = "Endorse" ? "&#9745;" : "&#9746;";
return `<div>
<strong>${subOrg.Name}</strong>
<div><p style="color:${color};">${subOrg[columns.position]} ${checkOrX} </p></div>
<blockquote><i>"${subOrg[columns.comment]}"</i></blockquote>
</div>
<br />`;

}).join("")
}
<br />`;
})
.join("")}
</span>`;
Expand Down Expand Up @@ -209,8 +232,8 @@ class Map extends Component {
// use a reduce to see if its all ayes, all nays, or a mixed bag
const countOccurances = (arr, check) =>
arr.reduce((a, c) => (c === check ? a + 1 : a), 0);
const countAyes = countOccurances(myValues, "In Favor Of");
const countNays = countOccurances(myValues, "Against");
const countAyes = countOccurances(myValues, "Endorse");
const countNays = countOccurances(myValues, "Oppose");

// check what color this variable should be
var color = "yel";
Expand Down