Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Commit

Permalink
Add build name to title, Fixes #171
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmcleod committed Jun 19, 2016
1 parent 3600a48 commit 1621361
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/app/pages/OutfittingPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ import Slider from '../components/Slider';
const SPEED_SERIES = ['boost', '4 Pips', '2 Pips', '0 Pips'];
const SPEED_COLORS = ['#0088d2', '#ff8c0d', '#D26D00', '#c06400'];

/**
* Document Title Generator
* @param {String} shipName Ship Name
* @param {String} buildName Build Name
* @return {String} Document title
*/
function getTitle(shipName, buildName) {
return `${shipName}${buildName ? ` - ${buildName}` : ''}`;
}

/**
* The Outfitting Page
*/
Expand Down Expand Up @@ -65,10 +75,11 @@ export default class OutfittingPage extends Page {
}

let fuelCapacity = ship.fuelCapacity;
this._getTitle = getTitle.bind(this, data.properties.name);

return {
error: null,
title: 'Outfitting - ' + data.properties.name,
title: this._getTitle(buildName),
costTab: Persist.getCostTab() || 'costs',
buildName,
newBuildName: buildName,
Expand Down Expand Up @@ -117,7 +128,7 @@ export default class OutfittingPage extends Page {
this._updateRoute(shipId, newBuildName, code);
}

this.setState({ buildName: newBuildName, code, savedCode: code });
this.setState({ buildName: newBuildName, code, savedCode: code, title: this._getTitle(newBuildName) });
}

/**
Expand Down

0 comments on commit 1621361

Please sign in to comment.