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

[Frontend][Review Metrics] Show old values #36

Merged
merged 2 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions publisher/src/components/DataUpload/DataUpload.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -526,3 +526,7 @@ export const RedText = styled.span`
export const OrangeText = styled.span`
color: ${palette.solid.orange};
`;

export const StrikethroughText = styled.span`
text-decoration: line-through;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export const DatapointsTableDetailsCell = styled.td`
font-weight: 400;
text-align: center;
border: 1px solid ${palette.highlight.grey3};
white-space: nowrap;
`;
export const DatapointsTableDetailsDivider = styled.tr`
height: 32px;
Expand Down
25 changes: 21 additions & 4 deletions publisher/src/components/ReviewMetrics/ReviewMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
Button,
DataUploadHeader,
OrangeText,
StrikethroughText,
} from "../DataUpload/DataUpload.styles";
import { UploadedMetric } from "../DataUpload/types";
import { formatDateShort, sortDatapointDimensions } from "../DataViz/utils";
Expand Down Expand Up @@ -280,11 +281,27 @@ const ReviewMetrics: React.FC = observer(() => {
value: string | number | null,
oldValue: string | number | null
) => {
// Uncomment this for special treatment when a datapoint is newly added
Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome! Thanks for putting the foundation here. I wonder if we should uncomment this for now, to facilitate debugging and also just to see how it feels? Maybe we can change the color or something instead of saying NEW?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what the new symbol should be, it could also be less noisy to instead have an indication when the value has been unchanged. I'll leave that up to a follow-up PR

// as opposed to returning the same value
// if (oldValue === null && value !== null) {
// return (
// <DatapointsTableDetailsCell key={key}>
// {value} NEW
// </DatapointsTableDetailsCell>
// );
// }
if (oldValue !== value) {
return (
<DatapointsTableDetailsCell key={key}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Love this!

<StrikethroughText>{oldValue}</StrikethroughText>
{` ➞ `}
{value}
<OrangeText>*</OrangeText>
</DatapointsTableDetailsCell>
);
}
return (
<DatapointsTableDetailsCell key={key}>
{value}
{oldValue !== null ? <OrangeText>*</OrangeText> : ""}
</DatapointsTableDetailsCell>
<DatapointsTableDetailsCell key={key}>{value}</DatapointsTableDetailsCell>
);
};

Expand Down