Add referral section to user settings

This allows those who have registered to referrer other students to Riot and have their referral counted for the campaign competition.
This commit is contained in:
Luke Barnard 2017-01-31 13:17:01 +00:00
parent 878e5593ba
commit c2b0c603c0
2 changed files with 24 additions and 1 deletions

View file

@ -444,6 +444,27 @@ module.exports = React.createClass({
);
},
_renderReferral: function() {
const teamToken = window.localStorage.getItem('mx_team_token');
if (!teamToken) {
return null;
}
if (typeof teamToken !== 'string') {
console.warn('Team token not a string');
return null;
}
const href = window.location.origin +
`/#/register?referrer=${this._me}&team_token=${teamToken}`;
return (
<div>
<h3>Referral</h3>
<div className="mx_UserSettings_section">
Refer a friend to Riot: <a href={href}>{href}</a>
</div>
</div>
);
},
_renderUserInterfaceSettings: function() {
var client = MatrixClientPeg.get();
@ -819,6 +840,8 @@ module.exports = React.createClass({
{accountJsx}
</div>
{this._renderReferral()}
{notification_area}
{this._renderUserInterfaceSettings()}

View file

@ -57,7 +57,7 @@ module.exports = React.createClass({
// URL of the riot-team-server to get team configurations and track referrals
teamServerURL: React.PropTypes.string.isRequired,
}),
teamSelected: null,
teamSelected: React.PropTypes.object,
defaultDeviceDisplayName: React.PropTypes.string,