Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Project Presence panel #1117

Merged
merged 5 commits into from Jun 7, 2019
Merged

Conversation

agnetedjupvik
Copy link
Collaborator

Features

Other changes

  • Renamed AnalyticsBanner to ProjectPresence, as it displays the overall project presence parts of the analytics data
  • Introduced HeaderPanel component consisting of an icon, headline and list of relevant information
  • Introduced some inline styling. This isn't used anywhere else as of now (there isn't much custom styling at all), but may be a good idea as it loads only the relevant CSS of the components displayed rather than all CSS at once

Copy link
Collaborator

@cathinkaw cathinkaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See a couple of comments.

@@ -0,0 +1,33 @@
import React from "react";
import { Heading, UnorderedList, ListItem } from "evergreen-ui";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have so far only moved it and not changed to using material-ui?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, planning on taking Evergreen out soon, but I left it out of this PR

import React from "react";
import { Heading, UnorderedList, ListItem } from "evergreen-ui";

export class HeaderPanel extends React.Component {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this name give us enough information about the component? Now the name says something about where it is used now, instead of what the component actually contains/is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree! I renamed it to PresenceIndicator, that fits with its current use, but it can be used for many other things, so I'm open to name suggestions:)

{this.props.list.map(
(data, index) => (
<ListItem key={index}>
{data.numberOfReports || data.inactiveDataCollectors} {data.name || data.healthRisk}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't rather the data that we send in be shaped so we have the correct format of it, instead of "forcing" this component to be linked to the datastructure (and name of properties) of the input data?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I rewrote it, now it takes any JSON Object and lists them "value-first" no matter the keys:

{name: "Cholera", numberOfReports: "20"} --> "20 Cholera"

Not very scalable, but compatible with the current API endpoints. Could be a good idea to include this as a test in a frontend testing framework in the future.

Source/Analytics/Web.Frontend/src/components/Map.js Outdated Show resolved Hide resolved
@cathinkaw cathinkaw self-assigned this Jun 6, 2019
@cathinkaw
Copy link
Collaborator

I also have a question. Back in the days when I last used react we defined the proptypes. Is this something that isn't done anymore? And could maybe my need to know what a component expects be solvec by adding typescript? (Ref: #1126)

… more agnostic towards its received data, and take out some unused code
@agnetedjupvik
Copy link
Collaborator Author

Yes, I think TypeScript is a great idea. Adding proptypes also work, but TypeScript is stricter, which I think will help streamline different contributions.

Copy link
Collaborator

@cathinkaw cathinkaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now :)

@agnetedjupvik agnetedjupvik merged commit 57a50d6 into IFRCGo:master Jun 7, 2019
@agnetedjupvik agnetedjupvik deleted the header-panel branch July 10, 2019 09:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants