-
Notifications
You must be signed in to change notification settings - Fork 22
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
Feature/CV2-5785: media dialog view ux updates to include media match reason #2256
base: epic/CV2-5510-why-media-is-in-cluster
Are you sure you want to change the base?
Changes from 7 commits
4afa1b8
1823f14
1227945
ea3b53f
8954e9d
567950f
0053975
da5c700
a579be2
582c346
ad7b79d
47bb428
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,8 @@ import Tipline from '../../icons/question_answer.svg'; | |
import Tooltip from '../cds/alerts-and-prompts/Tooltip'; | ||
import CheckMediaOrigin from '../../CheckMediaOrigin'; | ||
|
||
const getIconAndMessage = (type, user) => { | ||
switch (type) { | ||
const getIconAndMessage = (media_cluster_origin, media_cluster_origin_user) => { | ||
switch (media_cluster_origin) { | ||
case CheckMediaOrigin.TIPLINE_SUBMITTED: | ||
return { | ||
icon: <Tipline />, | ||
|
@@ -42,10 +42,10 @@ const getIconAndMessage = (type, user) => { | |
), | ||
tooltipMessage: ( | ||
<FormattedHTMLMessage | ||
defaultMessage="<strong>{user}</strong> uploaded this media using the Check interface" | ||
defaultMessage="<strong>{media_cluster_origin_user}</strong> uploaded this media using the Check interface" | ||
description="Tooltip message for User Added" | ||
id="mediaOrigin.userAddedTooltip" | ||
values={{ user }} | ||
values={{ media_cluster_origin_user }} | ||
/> | ||
), | ||
}; | ||
|
@@ -61,10 +61,10 @@ const getIconAndMessage = (type, user) => { | |
), | ||
tooltipMessage: ( | ||
<FormattedHTMLMessage | ||
defaultMessage="<strong>{user}</strong> added this media by merging from another cluster" | ||
defaultMessage="<strong>{media_cluster_origin_user}</strong> added this media by merging from another cluster" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ |
||
description="Tooltip message for User Merged" | ||
id="mediaOrigin.userMergedTooltip" | ||
values={{ user }} | ||
values={{ media_cluster_origin_user }} | ||
/> | ||
), | ||
}; | ||
|
@@ -80,10 +80,10 @@ const getIconAndMessage = (type, user) => { | |
), | ||
tooltipMessage: ( | ||
<FormattedHTMLMessage | ||
defaultMessage="<strong>{user}</strong> accepted this media as a suggested match" | ||
defaultMessage="<strong>{media_cluster_origin_user}</strong> accepted this media as a suggested match" | ||
description="Tooltip message for User Matched" | ||
id="mediaOrigin.userMatchedTooltip" | ||
values={{ user }} | ||
values={{ media_cluster_origin_user }} | ||
/> | ||
), | ||
}; | ||
|
@@ -114,8 +114,8 @@ const getIconAndMessage = (type, user) => { | |
} | ||
}; | ||
|
||
const MediaOrigin = ({ type, user }) => { | ||
const { icon, message, tooltipMessage } = getIconAndMessage(type, user); | ||
const MediaOrigin = ({ media_cluster_origin, media_cluster_origin_user }) => { | ||
const { icon, message, tooltipMessage } = getIconAndMessage(media_cluster_origin, media_cluster_origin_user); | ||
|
||
return ( | ||
<Tooltip | ||
|
@@ -135,13 +135,10 @@ const MediaOrigin = ({ type, user }) => { | |
); | ||
}; | ||
|
||
MediaOrigin.defaultProps = { | ||
user: 'Unknown User', | ||
}; | ||
|
||
MediaOrigin.propTypes = { | ||
type: PropTypes.number.isRequired, | ||
user: PropTypes.string, | ||
media_cluster_origin: PropTypes.number.isRequired, | ||
media_cluster_origin_user: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default MediaOrigin; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,20 +11,22 @@ import CheckMediaOrigin from '../../CheckMediaOrigin'; | |
import { parseStringUnixTimestamp } from '../../helpers'; | ||
import TimeBefore from '../TimeBefore'; | ||
|
||
const getIconAndMessage = (type, user, cluster, timestamp) => { | ||
const getIconAndMessage = (media_cluster_origin, media_cluster_relationship, media_cluster_origin_user, media_cluster_origin_timestamp) => { | ||
// The default messages are temporary, and will be updated in the ticket CV2-5785 | ||
const formattedTimestamp = <TimeBefore date={parseStringUnixTimestamp(timestamp)} />; | ||
switch (type) { | ||
const formattedTimestamp = <TimeBefore date={parseStringUnixTimestamp(media_cluster_origin_timestamp)} />; | ||
const media_cluster_origin_confirmed_by = media_cluster_relationship?.confirmed_by?.name; | ||
const media_cluster_origin_title = media_cluster_relationship?.target?.title; | ||
|
||
switch (media_cluster_origin) { | ||
case CheckMediaOrigin.TIPLINE_SUBMITTED: | ||
return { | ||
icon: <Tipline />, | ||
message: ( | ||
<> | ||
<FormattedHTMLMessage | ||
defaultMessage="This media was submitted via <strong>Tipline</strong> " | ||
defaultMessage="This media was submitted via <strong>Tipline</strong>, " | ||
description="Message for Tipline Submitted" | ||
id="mediaOriginBanner.tiplineSubmitted" | ||
values={{ timestamp }} | ||
/> | ||
{formattedTimestamp} | ||
</> | ||
|
@@ -36,10 +38,10 @@ const getIconAndMessage = (type, user, cluster, timestamp) => { | |
message: ( | ||
<> | ||
<FormattedHTMLMessage | ||
defaultMessage="This media was added to the cluster by <strong>{user}</strong> " | ||
description="Message for User Matched" | ||
defaultMessage="This media was added to the cluster by <strong>{media_cluster_origin_user}</strong>, " | ||
description="Message for User Added" | ||
id="mediaOriginBanner.userAdded" | ||
values={{ user }} | ||
values={{ media_cluster_origin_user }} | ||
/> | ||
{formattedTimestamp} | ||
</> | ||
|
@@ -51,10 +53,10 @@ const getIconAndMessage = (type, user, cluster, timestamp) => { | |
message: ( | ||
<> | ||
<FormattedHTMLMessage | ||
defaultMessage="This media was added to the cluster by <strong>{user}</strong> when merged from <strong><u>{cluster}</u></strong> " | ||
description="Message for User Matched" | ||
defaultMessage="This media was merged to the cluster by <strong>{media_cluster_origin_user}</strong>, " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ |
||
description="Message for User Merged" | ||
id="mediaOriginBanner.userMerged" | ||
values={{ user, cluster }} | ||
values={{ media_cluster_origin_user }} | ||
/> | ||
{formattedTimestamp} | ||
</> | ||
|
@@ -66,10 +68,10 @@ const getIconAndMessage = (type, user, cluster, timestamp) => { | |
message: ( | ||
<> | ||
<FormattedHTMLMessage | ||
defaultMessage="This media was added to the cluster by <strong>{user}</strong> when accepted from <strong><u>{cluster}</u></strong> " | ||
defaultMessage="This media was added to the cluster by <strong>{media_cluster_origin_confirmed_by}</strong> when accepted from <strong><u>{media_cluster_origin_title}</u></strong>, " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ |
||
description="Message for User Matched" | ||
id="mediaOriginBanner.userMatched" | ||
values={{ user, cluster }} | ||
values={{ media_cluster_origin_confirmed_by, media_cluster_origin_title }} | ||
/> | ||
{formattedTimestamp} | ||
</> | ||
|
@@ -81,7 +83,7 @@ const getIconAndMessage = (type, user, cluster, timestamp) => { | |
message: ( | ||
<> | ||
<FormattedHTMLMessage | ||
defaultMessage="This media was automatically matched to the cluster " | ||
defaultMessage="This media was automatically matched to the cluster, " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ |
||
description="Message for Auto Matched" | ||
id="mediaOriginBanner.autoMatched" | ||
/> | ||
|
@@ -99,9 +101,9 @@ const getIconAndMessage = (type, user, cluster, timestamp) => { | |
}; | ||
|
||
const MediaOriginBanner = ({ | ||
cluster, timestamp, type, user, | ||
media_cluster_origin, media_cluster_origin_timestamp, media_cluster_origin_user, media_cluster_relationship, | ||
}) => { | ||
const { icon, message } = getIconAndMessage(type, user, cluster, timestamp); | ||
const { icon, message } = getIconAndMessage(media_cluster_origin, media_cluster_relationship, media_cluster_origin_user, media_cluster_origin_timestamp); | ||
|
||
return ( | ||
<Alert | ||
|
@@ -114,10 +116,17 @@ const MediaOriginBanner = ({ | |
}; | ||
|
||
MediaOriginBanner.propTypes = { | ||
cluster: PropTypes.string.isRequired, | ||
timestamp: PropTypes.number.isRequired, | ||
type: PropTypes.number.isRequired, | ||
user: PropTypes.string.isRequired, | ||
media_cluster_origin: PropTypes.number.isRequired, | ||
media_cluster_origin_timestamp: PropTypes.number.isRequired, | ||
media_cluster_origin_user: PropTypes.string.isRequired, | ||
media_cluster_relationship: PropTypes.shape({ | ||
confirmed_by: PropTypes.shape({ | ||
name: PropTypes.string, | ||
}), | ||
target: PropTypes.shape({ | ||
title: PropTypes.string, | ||
}), | ||
}).isRequired, | ||
}; | ||
|
||
export default MediaOriginBanner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change slightly from:
...using the Check interface
to
...using Check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅