0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Shift HomePage to use a minimal brew

This commit is contained in:
G.Ambatte
2021-07-29 19:00:26 +12:00
parent 7fa1e16b5a
commit fdfea36614
3 changed files with 14 additions and 12 deletions

View File

@@ -44,12 +44,12 @@ const Homebrew = createClass({
<Route path='/edit/:id' component={(routeProps)=><EditPage id={routeProps.match.params.id} brew={this.props.brew} />}/>
<Route path='/share/:id' component={(routeProps)=><SharePage id={routeProps.match.params.id} brew={this.props.brew} />}/>
<Route path='/new/:id' component={(routeProps)=><NewPage id={routeProps.match.params.id} brew={this.props.brew} />}/>
<Route path='/new' exact component={(routeProps)=><NewPage/>}/>
<Route path='/new' exact component={(routeProps)=><NewPage />}/>
<Route path='/user/:username' component={(routeProps)=><UserPage username={routeProps.match.params.username} brews={this.props.brews} />}/>
<Route path='/print/:id' component={(routeProps)=><PrintPage brew={this.props.brew} query={queryString.parse(routeProps.location.search)} /> } />
<Route path='/print' exact component={(routeProps)=><PrintPage query={queryString.parse(routeProps.location.search)} /> } />
<Route path='/print/:id' component={(routeProps)=><PrintPage brew={this.props.brew} query={queryString.parse(routeProps.location.search)} />}/>
<Route path='/print' exact component={(routeProps)=><PrintPage query={queryString.parse(routeProps.location.search)} />}/>
<Route path='/changelog' exact component={()=><SharePage brew={this.props.brew} />}/>
<Route path='/' component={()=><HomePage welcomeText={this.props.welcomeText}/>}/>
<Route path='/' component={()=><HomePage brew={this.props.brew} />}/>
</Switch>
</div>
</Router>

View File

@@ -23,17 +23,15 @@ const HomePage = createClass({
getDefaultProps : function() {
return {
brew : {
text : ''
text : '',
welcomeText : ''
},
welcomeText : '',
ver : '0.0.0'
ver : '0.0.0'
};
},
getInitialState : function() {
return {
brew : {
text : this.props.welcomeText
}
brew : this.props.brew
};
},
handleSave : function(){
@@ -87,7 +85,7 @@ const HomePage = createClass({
</SplitPane>
</div>
<div className={cx('floatingSaveButton', { show: this.props.welcomeText != this.state.brew.text })} onClick={this.handleSave}>
<div className={cx('floatingSaveButton', { show: this.props.brew.welcomeText != this.state.brew.text })} onClick={this.handleSave}>
Save current <i className='fas fa-save' />
</div>

View File

@@ -107,7 +107,11 @@ app.get('/robots.txt', (req, res)=>{
//Home page
app.get('/', async (req, res, next)=>{
req.welcomeText = welcomeText;
const brew = {
text : welcomeText,
welcomeText : welcomeText
};
req.brew = brew;
return next();
});