0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-10 13:32:45 +00:00

Initial functionality pass

This commit is contained in:
G.Ambatte
2024-03-29 20:06:16 +13:00
parent 9f6bc10369
commit 963ec282d3
3 changed files with 67 additions and 21 deletions

View File

@@ -20,6 +20,8 @@ const SplitPane = require('naturalcrit/splitPane/splitPane.jsx');
const Editor = require('../../editor/editor.jsx'); const Editor = require('../../editor/editor.jsx');
const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx'); const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx');
const LockNotification = require('./lockNotification/lockNotification.jsx');
const Markdown = require('naturalcrit/markdown.js'); const Markdown = require('naturalcrit/markdown.js');
const { DEFAULT_BREW_LOAD } = require('../../../../server/brewDefaults.js'); const { DEFAULT_BREW_LOAD } = require('../../../../server/brewDefaults.js');
@@ -51,7 +53,8 @@ const EditPage = createClass({
autoSave : true, autoSave : true,
autoSaveWarning : false, autoSaveWarning : false,
unsavedTime : new Date(), unsavedTime : new Date(),
currentEditorPage : 0 currentEditorPage : 0,
displayLockMessage : this.props.brew.lock || false
}; };
}, },
savedBrew : null, savedBrew : null,
@@ -390,26 +393,30 @@ const EditPage = createClass({
{this.renderNavbar()} {this.renderNavbar()}
<div className='content'> <div className='content'>
<SplitPane onDragFinish={this.handleSplitMove} ref='pane'> {this.state.displayLockMessage ?
<Editor <LockNotification message={this.props.brew.lock.message} disableLock={()=>this.setState({ displayLockMessage: false })}/>
ref='editor' :
brew={this.state.brew} <SplitPane onDragFinish={this.handleSplitMove} ref='pane'>
onTextChange={this.handleTextChange} <Editor
onStyleChange={this.handleStyleChange} ref='editor'
onMetaChange={this.handleMetaChange} brew={this.state.brew}
reportError={this.errorReported} onTextChange={this.handleTextChange}
renderer={this.state.brew.renderer} onStyleChange={this.handleStyleChange}
/> onMetaChange={this.handleMetaChange}
<BrewRenderer reportError={this.errorReported}
text={this.state.brew.text} renderer={this.state.brew.renderer}
style={this.state.brew.style} />
renderer={this.state.brew.renderer} <BrewRenderer
theme={this.state.brew.theme} text={this.state.brew.text}
errors={this.state.htmlErrors} style={this.state.brew.style}
lang={this.state.brew.lang} renderer={this.state.brew.renderer}
currentEditorPage={this.state.currentEditorPage} theme={this.state.brew.theme}
/> errors={this.state.htmlErrors}
</SplitPane> lang={this.state.brew.lang}
currentEditorPage={this.state.currentEditorPage}
/>
</SplitPane>
}
</div> </div>
</div>; </div>;
} }

View File

@@ -0,0 +1,22 @@
require('./lockNotification.less');
const React = require('react');
const createClass = require('create-react-class');
const LockNotification = createClass({
displayName : 'LockNotification',
getInitialState : function() {
return {
disableLock : ()=>{}
};
},
render : function(){
return <div className='lockNotification'>
<h1>BREW LOCKED</h1>
<p>{this.props.message || 'Unable to retrieve Lock Message'}</p>
<button onClick={()=>{this.props.disableLock();}}>CLICK TO UNLOCK</button>
</div>;
}
});
module.exports = LockNotification;

View File

@@ -0,0 +1,17 @@
.lockNotification {
background-color: #ccc;
color: black;
padding: 10px;
margin: 25px 100px;
text-align: center;
button {
background-color: #333;
color: white;
margin-top: 10px;
&:hover {
background-color: #777;
}
}
}