diff --git a/client/homebrew/homePage/homePage.jsx b/client/homebrew/homePage/homePage.jsx index 87d508d..86e316c 100644 --- a/client/homebrew/homePage/homePage.jsx +++ b/client/homebrew/homePage/homePage.jsx @@ -6,7 +6,7 @@ var Statusbar = require('../statusbar/statusbar.jsx'); var PageContainer = require('../pageContainer/pageContainer.jsx'); var Editor = require('../editor/editor.jsx'); -var WelcomeText = require('./welcomeMessage.js'); +//var WelcomeText = require('./welcomeMessage.js'); @@ -14,9 +14,15 @@ var KEY = 'naturalCrit-homebrew'; var HomePage = React.createClass({ + getDefaultProps: function() { + return { + welcomeText : "" + }; + }, + getInitialState: function() { return { - text: WelcomeText + text: this.props.welcomeText }; }, diff --git a/client/homebrew/homePage/welcomeMessage.js b/client/homebrew/homePage/welcomeMessage.js deleted file mode 100644 index c0caec5..0000000 --- a/client/homebrew/homePage/welcomeMessage.js +++ /dev/null @@ -1,72 +0,0 @@ -module.exports = [ -"# The Homebrewery", -"Welcome traveler from an antique land. Please sit and tell us of what you have seen. The unheard of monsters, who slither and bite.", -"", -"Tell us of the wondrous items and and artifacts you have found, their mysteries yet to be unlocked. Of the vexing vocations and surprising skills you have seen.", -"", -"### Homebrew made easy", -"The Homebrewery allows for the creation and sharing of authentic looking Fifth-Edition homebrews, with just text editing. It accomplishes this by using [Markdown](https://help.github.com/articles/markdown-basics/) along with some custom CSS-styling.", -"", -"Stop worrying about learning photoshop, fiddling with spacing, or tracking down the PHB assets. Just focus on making your homebrew **great**.", -"", -"**Try it! **Simply edit the text on the left and watch it *update live* on the right.", -"", -"#### Features", -"* Monster Stat Blocks", -"* Full class tables", -"* Notes and Tables", -"* Images", -"* Vertical spacing, column breaks, and mutliple pages", -"", -"", -"#### Snippets", -"If you aren't used the Markdown-style syntax, don't worry! I've provided several **snippets** at the top of the editor. When clicked, these will *inject* text wherever your text cursor was.", -"", -"Each snippet is a common format from the Player's Handbook or is a feature of The Homebrewery. You'll never have to memorize exactly how a Monster Stat Block is suppose to be formatted.", -"", -"### Editing and Sharing", -"When you create your own homebrew you will be given a *edit url* and a *share url*. Any changes you make will be automatically saved to the database within a few seconds. Anyone with the edit url will be able to make edits to your homebrew. So be careful about who you share it with.", -"", -"Anyone with the *share url* will be able to access a read-only version of your homebrew.", -"", -"", -"> ##### Words of Caution", -"> ___", -"> * **Concurrent Editing** The Homebrewery does not support concurrent user editing. It's best one user at a time makes edits to avoid overwriting each other.", -"> * **Back-up your brews** I can not guarantee that I will support this project indefinitely. So if you'd like to hang on to your creation be sure to back up it up.", -"", -"", -"```", -"```", -"", -"### Images", -"Images can be included 'inline' with the text using Markdown-style images. However for background images more control is needed.", -"", -"Background images should be included as HTML-style img tags. Using inline CSS you can precisely position your image where you'd like it to be. The image **snippet** provides an example of doing this.", -"", -"", -"### Not quite Markdown", -"Although the Homebrewery uses Markdown, to get all the styling features from the PHB, we had to get a little creative. Some base HTML elements are not used as expected and I've had to include a few new keywords.", -"", -"___", -"* **Horizontal Rules** are generally used to *modify* existing elements into a different style. For example, a horizontal rule before a blockquote will give it the style of a Monster Stat Block instead of a note.", -"* **New Pages** are controlled by the author. It's impossible for the site to detect when the end of a page is reached, so indicate you'd like to start a new page with **`\page`** on its own line .", -"* **Code Blocks** are used only to indicate column breaks. Since they don't allow for styling within them, they weren't that useful to use.", -"* **HTML** can be used to get *just* the right look for your homebrew. I've included some examples in the snippet icons above the editor.", -"", -"", -"## Bugs, Issues, Suggestions?", -"Have an idea of how to make The Homebrewery better? Or did you find something that wasn't quite right? Head [here](https://github.com/stolksdorf/NaturalCrit/issues/new) and let me know!.", -"", -"### Planned Features", -"Here are a few features I'm planning next", -"* Convert to PDF", -"* Switch between DMG-style and Monster Manual-Style", -"* Download as images", -"", -"", -"", -"", -].join('\n'); - - diff --git a/client/homebrew/homePage/welcome_msg.txt b/client/homebrew/homePage/welcome_msg.txt new file mode 100644 index 0000000..e91a75b --- /dev/null +++ b/client/homebrew/homePage/welcome_msg.txt @@ -0,0 +1,67 @@ +# The Homebrewery +Welcome traveler from an antique land. Please sit and tell us of what you have seen. The unheard of monsters, who slither and bite. + +Tell us of the wondrous items and and artifacts you have found, their mysteries yet to be unlocked. Of the vexing vocations and surprising skills you have seen. + +### Homebrew made easy +The Homebrewery allows for the creation and sharing of authentic looking Fifth-Edition homebrews, with just text editing. It accomplishes this by using [Markdown](https://help.github.com/articles/markdown-basics/) along with some custom CSS-styling. + +Stop worrying about learning photoshop, fiddling with spacing, or tracking down the PHB assets. Just focus on making your homebrew **great**. + +**Try it! **Simply edit the text on the left and watch it *update live* on the right. + +#### Features +* Monster Stat Blocks +* Full class tables +* Notes and Tables +* Images +* Vertical spacing, column breaks, and mutliple pages + + +#### Snippets +If you aren't used the Markdown-style syntax, don't worry! I've provided several **snippets** at the top of the editor. When clicked, these will *inject* text wherever your text cursor was. + +Each snippet is a common format from the Player's Handbook or is a feature of The Homebrewery. You'll never have to memorize exactly how a Monster Stat Block is suppose to be formatted. + +### Editing and Sharing +When you create your own homebrew you will be given a *edit url* and a *share url*. Any changes you make will be automatically saved to the database within a few seconds. Anyone with the edit url will be able to make edits to your homebrew. So be careful about who you share it with. + +Anyone with the *share url* will be able to access a read-only version of your homebrew. + + +> ##### Words of Caution +> ___ +> * **Concurrent Editing** The Homebrewery does not support concurrent user editing. It's best one user at a time makes edits to avoid overwriting each other. +> * **Back-up your brews** I can not guarantee that I will support this project indefinitely. So if you'd like to hang on to your creation be sure to back up it up. + + +``` +``` + +### Images +Images can be included 'inline' with the text using Markdown-style images. However for background images more control is needed. + +Background images should be included as HTML-style img tags. Using inline CSS you can precisely position your image where you'd like it to be. The image **snippet** provides an example of doing this. + + +### Not quite Markdown +Although the Homebrewery uses Markdown, to get all the styling features from the PHB, we had to get a little creative. Some base HTML elements are not used as expected and I've had to include a few new keywords. + +___ +* **Horizontal Rules** are generally used to *modify* existing elements into a different style. For example, a horizontal rule before a blockquote will give it the style of a Monster Stat Block instead of a note. +* **New Pages** are controlled by the author. It's impossible for the site to detect when the end of a page is reached, so indicate you'd like to start a new page with **`page`** on its own line . +* **Code Blocks** are used only to indicate column breaks. Since they don't allow for styling within them, they weren't that useful to use. +* **HTML** can be used to get *just* the right look for your homebrew. I've included some examples in the snippet icons above the editor. + + +## Bugs, Issues, Suggestions? +Have an idea of how to make The Homebrewery better? Or did you find something that wasn't quite right? Head [here](https://github.com/stolksdorf/NaturalCrit/issues/new) and let me know!. + +### Planned Features +Here are a few features I'm planning next +* Convert to PDF +* Switch between DMG-style and Monster Manual-Style +* Download as images + + + diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index 7e34a1e..718dffc 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -13,7 +13,7 @@ var Homebrew = React.createClass({ getDefaultProps: function() { return { url : "", - text : "", + welcomeText : "", brew : { text : "", shareId : null, @@ -31,7 +31,7 @@ var Homebrew = React.createClass({ '/homebrew/share/:id' : (args) => { return }, - '/homebrew*' : , + '/homebrew*' : , }); }, render : function(){ diff --git a/package.json b/package.json index 8c60bd1..29b6291 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "classnames": "^2.2.0", "express": "^4.13.3", "gulp": "^3.9.0", - "html-pdf": "^1.4.0", "jsoneditor": "^4.2.1", "lodash": "^3.10.1", "marked": "^0.3.5", diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 0523751..a14945a 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -166,6 +166,8 @@ module.exports = function(app){ //Home and 404, etc. + var welcomeText = require('fs').readFileSync('./client/homebrew/homePage/welcome_msg.txt', 'utf8'); + app.get('/homebrew*', function (req, res) { vitreumRender({ page: './build/homebrew/bundle.dot', @@ -173,6 +175,7 @@ module.exports = function(app){ prerenderWith : './client/homebrew/homebrew.jsx', initialProps: { url: req.originalUrl, + welcomeText : welcomeText }, clearRequireCache : true, }, function (err, page) {