Skip to content
Open
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
1 change: 1 addition & 0 deletions src/components/carousel/carousel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
return (
<Thumbnail
creator={item.author.username}
creatorMembershipLabel={item.author.profile.membership_label}
href={href}
key={`${type}.${item.id}`}
loves={item.stats.loves}
Expand All @@ -99,7 +100,7 @@
Carousel.propTypes = {
className: PropTypes.string,
fromStarterProjectsPage: PropTypes.bool,
items: PropTypes.arrayOf(PropTypes.any),

Check warning on line 103 in src/components/carousel/carousel.jsx

View workflow job for this annotation

GitHub Actions / Build and Unit Tests

Prop type "any" is forbidden
settings: PropTypes.shape({
centerMode: PropTypes.bool,
dots: PropTypes.bool,
Expand All @@ -108,7 +109,7 @@
slidesToShow: PropTypes.number,
slidesToScroll: PropTypes.number,
variableWidth: PropTypes.bool,
responsive: PropTypes.array

Check warning on line 112 in src/components/carousel/carousel.jsx

View workflow job for this annotation

GitHub Actions / Build and Unit Tests

Prop type "array" is forbidden
}),
showLoves: PropTypes.bool,
showRemixes: PropTypes.bool,
Expand Down
1 change: 1 addition & 0 deletions src/components/carousel/legacy-carousel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
return (
<Thumbnail
creator={item.creator}
creatorMembershipLabel={item.creator_label}
href={href}
key={[type, item.id].join('.')}
loves={item.love_count}
Expand All @@ -100,7 +101,7 @@

Carousel.propTypes = {
className: PropTypes.string,
items: PropTypes.arrayOf(PropTypes.any),

Check warning on line 104 in src/components/carousel/legacy-carousel.jsx

View workflow job for this annotation

GitHub Actions / Build and Unit Tests

Prop type "any" is forbidden
settings: PropTypes.shape({
centerMode: PropTypes.bool,
dots: PropTypes.bool,
Expand All @@ -109,7 +110,7 @@
slidesToShow: PropTypes.number,
slidesToScroll: PropTypes.number,
variableWidth: PropTypes.bool,
responsive: PropTypes.array

Check warning on line 113 in src/components/carousel/legacy-carousel.jsx

View workflow job for this annotation

GitHub Actions / Build and Unit Tests

Prop type "array" is forbidden
}),
showLoves: PropTypes.bool,
showRemixes: PropTypes.bool,
Expand Down
39 changes: 39 additions & 0 deletions src/components/membership-label/membership-label.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const React = require('react');
const PropTypes = require('prop-types');
const {FormattedMessage} = require('react-intl');
const classNames = require('classnames');

require('./membership-label.scss');

// Expand with other labels if we starting supporting multiple types
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

const LABEL_BY_TYPE = {
1: 'membership.labels.member'
};

const MembershipLabel = ({
labelType,
outerClassName,
innerClassName
}) => {
const label = LABEL_BY_TYPE[labelType];

if (!label) {
return null;
}

return (
<span className={classNames('membership-label-container', outerClassName)}>
<span className={classNames('membership-label-text', innerClassName)}>
<FormattedMessage id={label} />
</span>
</span>
);
};

MembershipLabel.propTypes = {
labelType: PropTypes.number,
outerClassName: PropTypes.string,
innerClassName: PropTypes.string
};

module.exports = MembershipLabel;
21 changes: 21 additions & 0 deletions src/components/membership-label/membership-label.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@use "../../colors";

.membership-label-container {
display: inline-flex;
padding: 0.125rem 0.3125rem;
justify-content: center;
align-items: center;
border-radius: 1.125rem;
background: colors.$ui-purple-dark;
margin-left: 0.25rem;
vertical-align: middle;
// Align the label with the text rather that the text-line
transform: translateY(-0.05rem);
}

.membership-label-text {
color: colors.$ui-white;
font-size: 0.5rem;
font-weight: 500;
line-height: normal;
}
5 changes: 5 additions & 0 deletions src/components/thumbnail/thumbnail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ const React = require('react');
require('./thumbnail.scss');

const ThumbnailRemoveButton = require('./thumbnail-remove-button.jsx');
const MembershipLabel = require('../../components/membership-label/membership-label.jsx');

const Thumbnail = ({
alt = '',
avatar = '',
className,
creator,
creatorMembershipLabel,
favorites,
href = '#',
linkTitle = true,
Expand Down Expand Up @@ -110,12 +112,14 @@ const Thumbnail = ({
info.push(titleElement);

if (creator) {
const shouldShowMembershipLabel = !showAvatar && !!creatorMembershipLabel;
info.push(
<div
className="thumbnail-creator"
key="creator"
>
<a href={`/users/${creator}/`}>{creator}</a>
{shouldShowMembershipLabel && <MembershipLabel labelType={creatorMembershipLabel} />}
</div>
);
}
Expand Down Expand Up @@ -162,6 +166,7 @@ Thumbnail.propTypes = {
avatar: PropTypes.string,
className: PropTypes.string,
creator: PropTypes.string,
creatorMembershipLabel: PropTypes.number,
favorites: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
href: PropTypes.string,
linkTitle: PropTypes.bool,
Expand Down
4 changes: 3 additions & 1 deletion src/l10n.json
Original file line number Diff line number Diff line change
Expand Up @@ -549,5 +549,7 @@
"feedback.answer.debugging.notHelpful": "Not helpful at all",
"feedback.answer.debugging.littleHelpful": "A little helpful",
"feedback.answer.debugging.helpful": "Helpful",
"feedback.answer.debugging.veryHelpful": "Very helpful"
"feedback.answer.debugging.veryHelpful": "Very helpful",

"membership.labels.member": "Member"
}
17 changes: 11 additions & 6 deletions src/views/messages/message-rows/become-host.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const PropTypes = require('prop-types');
const React = require('react');

const SocialMessage = require('../../../components/social-message/social-message.jsx');
const MembershipLabel = require('../../../components/membership-label/membership-label.jsx');

const BecomeHostMessage = props => (
<SocialMessage
Expand All @@ -21,12 +22,15 @@ const BecomeHostMessage = props => (
usernameOrScratchTeam: (
props.adminActor ?
<FormattedMessage id="messages.becomeHostScratchTeam" /> :
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
<span>
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
{!!props.actorLabel && <MembershipLabel labelType={props.actorLabel} />}
</span>
),
studio: (
<a href={`/studios/${props.studioId}/`}>
Expand All @@ -40,6 +44,7 @@ const BecomeHostMessage = props => (

BecomeHostMessage.propTypes = {
actorUsername: PropTypes.string.isRequired,
actorLabel: PropTypes.number,
adminActor: PropTypes.bool,
className: PropTypes.string,
datetimePromoted: PropTypes.string.isRequired,
Expand Down
17 changes: 11 additions & 6 deletions src/views/messages/message-rows/become-manager.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const PropTypes = require('prop-types');
const React = require('react');

const SocialMessage = require('../../../components/social-message/social-message.jsx');
const MembershipLabel = require('../../../components/membership-label/membership-label.jsx');

const BecomeManagerMessage = props => (
<SocialMessage
Expand All @@ -19,12 +20,15 @@ const BecomeManagerMessage = props => (
id="messages.becomeManagerText"
values={{
username: (
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
<span>
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
{!!props.actorLabel && <MembershipLabel labelType={props.actorLabel} />}
</span>
),
studio: (
<a href={`/studios/${props.studioId}/`}>
Expand All @@ -38,6 +42,7 @@ const BecomeManagerMessage = props => (

BecomeManagerMessage.propTypes = {
actorUsername: PropTypes.string.isRequired,
actorLabel: PropTypes.number,
className: PropTypes.string,
datetimePromoted: PropTypes.string.isRequired,
studioId: PropTypes.number.isRequired,
Expand Down
17 changes: 11 additions & 6 deletions src/views/messages/message-rows/curator-invite.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const React = require('react');

const intlShape = require('../../../lib/intl-shape');
const SocialMessage = require('../../../components/social-message/social-message.jsx');
const MembershipLabel = require('../../../components/membership-label/membership-label.jsx');

const CuratorInviteMessage = props => (
<SocialMessage
Expand All @@ -21,12 +22,15 @@ const CuratorInviteMessage = props => (
id="messages.curatorInviteText"
values={{
actorLink: (
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
<span>
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
{!!props.actorLabel && <MembershipLabel labelType={props.actorLabel} />}
</span>
),
studioLink: (
<a href={`/studios/${props.studioId}/`}>
Expand All @@ -45,6 +49,7 @@ const CuratorInviteMessage = props => (

CuratorInviteMessage.propTypes = {
actorUsername: PropTypes.string.isRequired,
actorLabel: PropTypes.number,
className: PropTypes.string,
datetimePromoted: PropTypes.string.isRequired,
intl: intlShape,
Expand Down
17 changes: 11 additions & 6 deletions src/views/messages/message-rows/favorite-project.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const PropTypes = require('prop-types');
const React = require('react');

const SocialMessage = require('../../../components/social-message/social-message.jsx');
const MembershipLabel = require('../../../components/membership-label/membership-label.jsx');

const FavoriteProjectMessage = props => (
<SocialMessage
Expand All @@ -19,12 +20,15 @@ const FavoriteProjectMessage = props => (
id="messages.favoriteText"
values={{
profileLink: (
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
<span>
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
{!!props.actorLabel && <MembershipLabel labelType={props.actorLabel} />}
</span>
),
projectLink: (
<a href={`/projects/${props.projectId}`}>
Expand All @@ -38,6 +42,7 @@ const FavoriteProjectMessage = props => (

FavoriteProjectMessage.propTypes = {
actorUsername: PropTypes.string.isRequired,
actorLabel: PropTypes.number,
className: PropTypes.string,
favoriteDateTime: PropTypes.string.isRequired,
projectId: PropTypes.number.isRequired,
Expand Down
19 changes: 12 additions & 7 deletions src/views/messages/message-rows/follow-user.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const PropTypes = require('prop-types');
const React = require('react');

const SocialMessage = require('../../../components/social-message/social-message.jsx');
const MembershipLabel = require('../../../components/membership-label/membership-label.jsx');

const FollowUserMessage = props => (
<SocialMessage
Expand All @@ -19,12 +20,15 @@ const FollowUserMessage = props => (
id="messages.followText"
values={{
profileLink: (
<a
className="social-messages-profile-link"
href={`/users/${props.followerUsername}/`}
>
{props.followerUsername}
</a>
<span>
<a
className="social-messages-profile-link"
href={`/users/${props.followerUsername}/`}
>
{props.followerUsername}
</a>
{!!props.followerLabel && <MembershipLabel labelType={props.followerLabel} />}
</span>
)
}}
/>
Expand All @@ -34,7 +38,8 @@ const FollowUserMessage = props => (
FollowUserMessage.propTypes = {
className: PropTypes.string,
followDateTime: PropTypes.string.isRequired,
followerUsername: PropTypes.string.isRequired
followerUsername: PropTypes.string.isRequired,
followerLabel: PropTypes.number
};

module.exports = FollowUserMessage;
17 changes: 11 additions & 6 deletions src/views/messages/message-rows/love-project.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const PropTypes = require('prop-types');
const React = require('react');

const SocialMessage = require('../../../components/social-message/social-message.jsx');
const MembershipLabel = require('../../../components/membership-label/membership-label.jsx');

const LoveProjectMessage = props => (
<SocialMessage
Expand All @@ -19,12 +20,15 @@ const LoveProjectMessage = props => (
id="messages.loveText"
values={{
profileLink: (
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
<span>
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
{!!props.actorLabel && <MembershipLabel labelType={props.actorLabel} />}
</span>
),
projectLink: (
<a href={`/projects/${props.projectId}`}>
Expand All @@ -38,6 +42,7 @@ const LoveProjectMessage = props => (

LoveProjectMessage.propTypes = {
actorUsername: PropTypes.string.isRequired,
actorLabel: PropTypes.number,
className: PropTypes.string,
loveDateTime: PropTypes.string.isRequired,
projectId: PropTypes.number.isRequired,
Expand Down
17 changes: 11 additions & 6 deletions src/views/messages/message-rows/remix-project.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const PropTypes = require('prop-types');
const React = require('react');

const SocialMessage = require('../../../components/social-message/social-message.jsx');
const MembershipLabel = require('../../../components/membership-label/membership-label.jsx');

const RemixProjectMessage = props => (
<SocialMessage
Expand All @@ -19,12 +20,15 @@ const RemixProjectMessage = props => (
id="messages.remixText"
values={{
profileLink: (
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
<span>
<a
className="social-messages-profile-link"
href={`/users/${props.actorUsername}/`}
>
{props.actorUsername}
</a>
{!!props.actorLabel && <MembershipLabel labelType={props.actorLabel} />}
</span>
),
theRemixLink: (
<a href={`/projects/${props.projectId}`}>
Expand All @@ -43,6 +47,7 @@ const RemixProjectMessage = props => (

RemixProjectMessage.propTypes = {
actorUsername: PropTypes.string.isRequired,
actorLabel: PropTypes.number,
className: PropTypes.string,
parentId: PropTypes.number.isRequired,
parentTitle: PropTypes.string.isRequired,
Expand Down
Loading
Loading