mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-22 15:17:53 -05:00
Split follow splash into FollowUser and FollowStudio
This commit is contained in:
parent
7f9ffada5f
commit
544b1e1d45
5 changed files with 90 additions and 58 deletions
43
src/views/splash/activity-rows/follow-studio.jsx
Normal file
43
src/views/splash/activity-rows/follow-studio.jsx
Normal file
|
@ -0,0 +1,43 @@
|
|||
const classNames = require('classnames');
|
||||
const FormattedMessage = require('react-intl').FormattedMessage;
|
||||
const PropTypes = require('prop-types');
|
||||
const React = require('react');
|
||||
|
||||
const SocialMessage = require('../../../components/social-message/social-message.jsx');
|
||||
|
||||
const FollowStudioMessage = props => (
|
||||
<SocialMessage
|
||||
as="div"
|
||||
className={classNames(
|
||||
'mod-follow-studio',
|
||||
props.className
|
||||
)}
|
||||
datetime={props.followDateTime}
|
||||
>
|
||||
<FormattedMessage
|
||||
id="messages.followStudioText"
|
||||
values={{
|
||||
profileLink: (
|
||||
<a href={`/users/${props.followerUsername}/`}>
|
||||
{props.followerUsername}
|
||||
</a>
|
||||
),
|
||||
studioLink: (
|
||||
<a href={`/studios/${props.followeeId}`}>
|
||||
{props.followeeTitle}
|
||||
</a>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</SocialMessage>
|
||||
);
|
||||
|
||||
FollowStudioMessage.propTypes = {
|
||||
className: PropTypes.string,
|
||||
followDateTime: PropTypes.string.isRequired,
|
||||
followeeId: PropTypes.string.isRequired,
|
||||
followeeTitle: PropTypes.string.isRequired,
|
||||
followerUsername: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
module.exports = FollowStudioMessage;
|
42
src/views/splash/activity-rows/follow-user.jsx
Normal file
42
src/views/splash/activity-rows/follow-user.jsx
Normal file
|
@ -0,0 +1,42 @@
|
|||
const classNames = require('classnames');
|
||||
const FormattedMessage = require('react-intl').FormattedMessage;
|
||||
const PropTypes = require('prop-types');
|
||||
const React = require('react');
|
||||
|
||||
const SocialMessage = require('../../../components/social-message/social-message.jsx');
|
||||
|
||||
const FollowUserMessage = props => (
|
||||
<SocialMessage
|
||||
as="div"
|
||||
className={classNames(
|
||||
'mod-follow-user',
|
||||
props.className
|
||||
)}
|
||||
datetime={props.followDateTime}
|
||||
>
|
||||
<FormattedMessage
|
||||
id="messages.followText"
|
||||
values={{
|
||||
profileLink: (
|
||||
<a href={`/users/${props.followerUsername}/`}>
|
||||
{props.followerUsername}
|
||||
</a>
|
||||
),
|
||||
followeeLink: (
|
||||
<a href={`/users/${props.followeeId}/`}>
|
||||
{props.followeeId}
|
||||
</a>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</SocialMessage>
|
||||
);
|
||||
|
||||
FollowUserMessage.propTypes = {
|
||||
className: PropTypes.string,
|
||||
followDateTime: PropTypes.string.isRequired,
|
||||
followeeId: PropTypes.string.isRequired,
|
||||
followerUsername: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
module.exports = FollowUserMessage;
|
|
@ -1,55 +0,0 @@
|
|||
const classNames = require('classnames');
|
||||
const FormattedMessage = require('react-intl').FormattedMessage;
|
||||
const PropTypes = require('prop-types');
|
||||
const React = require('react');
|
||||
|
||||
const SocialMessage = require('../../../components/social-message/social-message.jsx');
|
||||
|
||||
const FollowMessage = props => {
|
||||
let followeeLink = '';
|
||||
let followeeTitle = '';
|
||||
if (typeof props.followeeTitle === 'undefined') {
|
||||
followeeLink = `/users/${props.followeeId}`;
|
||||
followeeTitle = props.followeeId;
|
||||
} else {
|
||||
followeeLink = `/studios/${props.followeeId}`;
|
||||
followeeTitle = props.followeeTitle;
|
||||
}
|
||||
|
||||
return (
|
||||
<SocialMessage
|
||||
as="div"
|
||||
className={classNames(
|
||||
'mod-follow-user',
|
||||
props.className
|
||||
)}
|
||||
datetime={props.followDateTime}
|
||||
>
|
||||
<FormattedMessage
|
||||
id="messages.followText"
|
||||
values={{
|
||||
profileLink: (
|
||||
<a href={`/users/${props.followerUsername}/`}>
|
||||
{props.followerUsername}
|
||||
</a>
|
||||
),
|
||||
followeeLink: (
|
||||
<a href={followeeLink}>
|
||||
{followeeTitle}
|
||||
</a>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</SocialMessage>
|
||||
);
|
||||
};
|
||||
|
||||
FollowMessage.propTypes = {
|
||||
className: PropTypes.string,
|
||||
followDateTime: PropTypes.string.isRequired,
|
||||
followeeId: PropTypes.string.isRequired,
|
||||
followeeTitle: PropTypes.string,
|
||||
followerUsername: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
module.exports = FollowMessage;
|
|
@ -14,6 +14,7 @@
|
|||
"messages.becomeManagerText": "{username} was promoted to manager of {studio}",
|
||||
"messages.favoriteText": "{profileLink} favorited {projectLink}",
|
||||
"messages.followText": "{profileLink} is now following {followeeLink}",
|
||||
"messages.followStudioText": "{profileLink} is now following {studioLink}",
|
||||
"messages.loveText": "{profileLink} loved {projectLink}",
|
||||
"messages.remixText": "{profileLink} remixed {remixedProjectLink} as {projectLink}",
|
||||
"messages.shareText": "{profileLink} shared the project {projectLink}",
|
||||
|
|
|
@ -26,7 +26,8 @@ const Welcome = require('../../components/welcome/welcome.jsx');
|
|||
const BecomeCuratorMessage = require('./activity-rows/become-curator.jsx');
|
||||
const BecomeManagerMessage = require('./activity-rows/become-manager.jsx');
|
||||
const FavoriteProjectMessage = require('./activity-rows/favorite-project.jsx');
|
||||
const FollowMessage = require('./activity-rows/follow.jsx');
|
||||
const FollowUserMessage = require('./activity-rows/follow-user.jsx');
|
||||
const FollowStudioMessage = require('./activity-rows/follow-studio.jsx');
|
||||
const LoveProjectMessage = require('./activity-rows/love-project.jsx');
|
||||
const RemixProjectMessage = require('./activity-rows/remix-project.jsx');
|
||||
const ShareProjectMessage = require('./activity-rows/share-project.jsx');
|
||||
|
@ -53,7 +54,7 @@ class ActivityList extends React.Component {
|
|||
switch (message.type) {
|
||||
case 'followuser':
|
||||
return (
|
||||
<FollowMessage
|
||||
<FollowUserMessage
|
||||
followDateTime={message.datetime_created}
|
||||
followeeId={message.followed_username}
|
||||
followerUsername={message.actor_username}
|
||||
|
@ -62,7 +63,7 @@ class ActivityList extends React.Component {
|
|||
);
|
||||
case 'followstudio':
|
||||
return (
|
||||
<FollowMessage
|
||||
<FollowStudioMessage
|
||||
followDateTime={message.datetime_created}
|
||||
followeeId={message.gallery_id}
|
||||
followeeTitle={message.title}
|
||||
|
|
Loading…
Reference in a new issue