Skip to content

Commit

Permalink
dynamic title. sure to break.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmorris committed Mar 15, 2017
1 parent 8c65444 commit 6435c02
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class About extends Component {
</div>
</div>);
}

componentDidMount() {
document.title = "About - SongSim";
}

render() {
var chapter = this.props.params.chapter || 'default';
Expand Down
4 changes: 4 additions & 0 deletions src/Gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class Gallery extends Component {
return this.props.params.cat || DEFAULT_CAT_SLUG;
}

componentDidMount() {
document.title = "Gallery - SongSim";
}

renderCanned = (c, i) => {
let kls = "img-responsive";
if (c.mini) {
Expand Down
3 changes: 3 additions & 0 deletions src/Songsim.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class Songsim extends Component {
this.props.router.replace('/');
}
);
document.title = config.base_title;
} else if (props.location.pathname === "/" + CUSTOM_SLUG) {
// We don't allow editing in mobile mode. Cause I was too lazy to build the UI.
if (this.state.mobile) {
Expand All @@ -114,12 +115,14 @@ class Songsim extends Component {
var canned = SongSelector.lookupCanned(songId);
if (canned) {
SongSelector.loadSong(this.onTextChange, canned);
document.title = canned.title + ' - ' + config.base_title;
} else {
console.error(`Uh oh. Failed to load slug ${songId}`);
}
} else {
// Return the default landing song.
var c = LANDING_CANNED;
document.title = config.base_title;
return CannedVerse.fromCanned(c, LANDING_LYRICS);
}
// If we've reached this far, we must be loading asynchronously. Return nothing.
Expand Down
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var config = {
rect_saturation: 100, // range [0-100]
rect_lightness: 50, // range [0-100]
testingFBKey: '-KeAcPBicxmHgZNEY9UM',
base_title: 'SongSim',
// Make sure the two options below sum to 1. (I know, this is dumb. Too lazy to refactor.)
stopwords: false,
default_ignore_singletons: true,
Expand Down

0 comments on commit 6435c02

Please sign in to comment.