From b817148d1c949f87cb59e78cb5ab29f7ade4bfc3 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Tue, 7 Dec 2021 22:09:01 -0600 Subject: [PATCH 01/10] Initial page for migrating from GMB to HB --- client/homebrew/pages/homePage/migrate_gmb.md | 174 ++++++++++++++++++ server.js | 12 ++ 2 files changed, 186 insertions(+) create mode 100644 client/homebrew/pages/homePage/migrate_gmb.md diff --git a/client/homebrew/pages/homePage/migrate_gmb.md b/client/homebrew/pages/homePage/migrate_gmb.md new file mode 100644 index 000000000..f90eaff18 --- /dev/null +++ b/client/homebrew/pages/homePage/migrate_gmb.md @@ -0,0 +1,174 @@ +# How to Convert a GMBinder Document to Homebrewery +Here you will find a number of steps to guide you through converting a GMBinder document into a Homebrewery document. + +**This document will evolve as users like yourself inform us of issues with it, or areas of conversion that it does not cover. _Please_ reach out if you have any suggestions for this document.** + +The first thing you'll want to do is switch the editor's rendering engine from `Legacy` to `v3`. This will be the renderer we design features for moving forward. + +### Simple Text Replacements +To make your life a little easier with this section, we recommend using a text editor like [VSCode](https://code.visualstudio.com/) or Notepad. + +The following table describes GMBinder elements and their Homebrewery counterparts. A simple find/replace should get these in working order. + +| GMBinder | Homebrewery | +|:----------------|:---| +| `\pagebreak` | `\page` | +| `======` | `\page` | +| `\pagebreaknum` | `{{pageNumber,auto}}\n\page` | +| `@=====` | `{{pageNumber,auto}}\n\page` | +| `\columnbreak` | `\column` | +| `.phb` | `.page` | + +### Margins and Padding +Any manual margins and padding to push text down the page will likely need to be updated. Something to note is immediately after a column break + +\page + +## Stat Blocks + +{{wide +There are pretty significant differences between stat blocks on GMBinder and Homebrewery. In this section we will describe a list of find/replace commands you can run against your GMB stat block to help make migrating them easier. +}} + +### GMBinder Example: + +``` +___ +> ## Centaur +> *Large Monstrosity, neutral good* +>___ +> - **Armor Class** 12 +> - **Hit Points** 45(6d10 + 12) +> - **Speed** 50ft. +>___ +>|STR|DEX|CON|INT|WIS|CHA| +>|:---:|:---:|:---:|:---:|:---:|:---:| +>|18 (+4)|14 (+2)|14 (+2)|9 (-1)|13 (+1)|11 (+0)| +>___ +> - **Skills** Athletics +6, Perception +3, Survival +3 +> - **Senses** passive Perception 13 +> - **Languages** Elvish, Sylvan +> - **Challenge** 2 (450 XP) +> ___ +> ***Charge.*** If the centaur moves at least 30 feet straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage. +> +> ***Second Thing*** More details. +> +> ### Actions +> ***Multiattack.*** The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow. +> +> ***Pike.*** *Melee Weapon Attack:* +6 to hit, reach 10 ft., one target. *Hit:* 9 (1d10 + 4) piercing damage. +> +> ***Hooves.*** *Melee Weapon Attack:* +6 to hit, reach 5 ft., one target. *Hit:* 11 (2d6 + 4) bludgeoning damage. +> +> ***Longbow.*** *Ranged Weapon Attack:* +4 to hit, range 150/600 ft., one target. *Hit:* 6 (1d8 + 2) piercing damage. +``` + +\column + +### Homebrewery example: + +``` +{{monster +## Centaur +*Large monstrosity, neutral good* +___ +**Armor Class** :: 12 +**Hit Points** :: 45(6d10 + 12) +**Speed** :: 50ft. +___ +| STR | DEX | CON | INT | WIS | CHA | +|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:| +|18 (+4)|14 (+2)|14 (+2)|9 (-1) |13 (+1)|11 (+0)| +___ +**Skills** :: Athletics +6, Perception +3, Survival +3 +**Senses** :: passive Perception 13 +**Languages** :: Elvish, Sylvan +**Challenge** :: 2 (450 XP) +___ +***Charge.*** If the centaur moves at least 30 feet straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage. +: +***Second Thing*** More details. + +### Actions +***Multiattack.*** The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow. +: +***Pike.*** *Melee Weapon Attack:* +6 to hit, reach 10 ft., one target. *Hit:* 9 (1d10 + 4) piercing damage. +: +***Hooves.*** *Melee Weapon Attack:* +6 to hit, reach 5 ft., one target. *Hit:* 11 (2d6 + 4) bludgeoning damage. +: +***Longbow.*** *Ranged Weapon Attack:* +4 to hit, range 150/600 ft., one target. *Hit:* 6 (1d8 + 2) piercing damage. +}} +``` + +\page + +{{monster +## Centaur +*Large monstrosity, neutral good* +___ +**Armor Class** :: 12 +**Hit Points** :: 45(6d10 + 12) +**Speed** :: 50ft. +___ +| STR | DEX | CON | INT | WIS | CHA | +|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:| +|18 (+4)|14 (+2)|14 (+2)|9 (-1) |13 (+1)|11 (+0)| +___ +**Skills** :: Athletics +6, Perception +3, Survival +3 +**Senses** :: passive Perception 13 +**Languages** :: Elvish, Sylvan +**Challenge** :: 2 (450 XP) +___ +***Charge.*** If the centaur moves at least 30 feet straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage. +: +***Second Thing*** More details. + +### Actions +***Multiattack.*** The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow. +: +***Pike.*** *Melee Weapon Attack:* +6 to hit, reach 10 ft., one target. *Hit:* 9 (1d10 + 4) piercing damage. +: +***Hooves.*** *Melee Weapon Attack:* +6 to hit, reach 5 ft., one target. *Hit:* 11 (2d6 + 4) bludgeoning damage. +: +***Longbow.*** *Ranged Weapon Attack:* +4 to hit, range 150/600 ft., one target. *Hit:* 6 (1d8 + 2) piercing damage. +}} + +\column + +**Use these find/replace commands in the order listed for the best result.** + +#### Blockquotes +The key difference is the lack of blockquotes. GMBinder uses the `>` symbol at the start of the line for each line in the stat block, and Homebrewery's v3 renderer does not. Running the following find/replace commands with regex enabled should remove the blockquotes: + +| Find | Replace | +|:------|:--------| +| `^> ` | | +| `^>` | | + +#### Lists +The basic characteristics and advanced characteristics sections are not list elements in Homebrewery. You can remove them by finding `^- ` and replacing it with nothing. + +#### Spacing +In order to have the correct spacing after removing the list elements, you will want to add `\:\:` between the name of each basic/advanced characteristic and its value. i.e: +``` +**Skills** :: Athletics +6 +``` + +: + +Additionally, in the special traits and actions sections, you will want to add a `\:` at the beginning of each line that separates a trait/action from another, as seen below. This can be accomplished with find/replace by replacing `^$` with `\:`. + +``` +### Actions +***Multiattack.*** The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow. +: +***Pike.*** *Melee Weapon Attack:* +6 to hit, reach 10 ft., one target. *Hit:* 9 (1d10 + 4) piercing damage. +``` + +: + +#### Final Notes +Lastly you will want to remove the leading `___` that started the stat block in GMBinder, and replace that with `{{monster` before the stat block, and `}}` after it. If you want a frame around the stat block, you can use `{{monster,frame` instead. + + diff --git a/server.js b/server.js index a3a97cddf..f68c326ae 100644 --- a/server.js +++ b/server.js @@ -103,6 +103,7 @@ app.use(require('./server/admin.api.js')); const HomebrewModel = require('./server/homebrew.model.js').model; const welcomeText = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg.md', 'utf8'); const welcomeTextV3 = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg_v3.md', 'utf8'); +const migrateGMBText = require('fs').readFileSync('./client/homebrew/pages/homePage/migrate_gmb.md', 'utf8'); const changelogText = require('fs').readFileSync('./changelog.md', 'utf8'); const faqText = require('fs').readFileSync('./faq.md', 'utf8'); @@ -133,6 +134,17 @@ app.get('/v3_preview', async (req, res, next)=>{ return next(); }); +//GMBinder Migration Guide +app.get('/migrate-from-gmb', async (req, res, next)=>{ + const brew = { + text : migrateGMBText, + renderer : 'V3' + }; + splitTextAndStyle(brew); + req.brew = brew; + return next(); +}); + //Changelog page app.get('/changelog', async (req, res, next)=>{ const brew = { From f1c4910993d601ab57176f65ff5730e053fa2597 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Fri, 10 Dec 2021 20:25:31 -0600 Subject: [PATCH 02/10] Add to migrate document and update colon-replacement for the markdown renderer --- client/homebrew/pages/homePage/migrate_gmb.md | 13 ++++--------- shared/naturalcrit/markdown.js | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/client/homebrew/pages/homePage/migrate_gmb.md b/client/homebrew/pages/homePage/migrate_gmb.md index f90eaff18..5a70452df 100644 --- a/client/homebrew/pages/homePage/migrate_gmb.md +++ b/client/homebrew/pages/homePage/migrate_gmb.md @@ -139,25 +139,20 @@ ___ **Use these find/replace commands in the order listed for the best result.** #### Blockquotes -The key difference is the lack of blockquotes. GMBinder uses the `>` symbol at the start of the line for each line in the stat block, and Homebrewery's v3 renderer does not. Running the following find/replace commands with regex enabled should remove the blockquotes: - -| Find | Replace | -|:------|:--------| -| `^> ` | | -| `^>` | | +The key difference is the lack of blockquotes. GMBinder uses the `>` symbol at the start of the line for each line in the stat block, and Homebrewery's v3 renderer does not. **You will want to remove all `>` characters at the beginning of all lines, and delete any leading spaces.** #### Lists -The basic characteristics and advanced characteristics sections are not list elements in Homebrewery. You can remove them by finding `^- ` and replacing it with nothing. +The basic characteristics and advanced characteristics sections are not list elements in Homebrewery. **You will want to remove all `-` or `*` characters from the beginning of lines.** #### Spacing -In order to have the correct spacing after removing the list elements, you will want to add `\:\:` between the name of each basic/advanced characteristic and its value. i.e: +In order to have the correct spacing after removing the list elements, **you will want to add two colons (`::`) between the name of each basic/advanced characteristic and its value.** i.e: ``` **Skills** :: Athletics +6 ``` : -Additionally, in the special traits and actions sections, you will want to add a `\:` at the beginning of each line that separates a trait/action from another, as seen below. This can be accomplished with find/replace by replacing `^$` with `\:`. +Additionally, in the special traits and actions sections, you will want to add a colon at the beginning of each line that separates a trait/action from another, as seen below. **Any empty lines between special traits and actions should contain only a colon.** ``` ### Actions diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 5003d1053..10e92eb4e 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -535,7 +535,24 @@ module.exports = { marked : Markdown, render : (rawBrewText)=>{ rawBrewText = rawBrewText.replace(/^\\column$/gm, `\n
\n`) - .replace(/^(:+)$/gm, (match)=>`${`
`.repeat(match.length)}\n`); + .replace(/^(:+)$/gm, (match, _, i)=>{ + let test, matches=[]; + const codeBlock = /`/gm, inlineCodeBlock = /[^`]`[^`]/g; + while (test = codeBlock.exec(rawBrewText)) { + matches.push(test); + } + // console.log(match, m, i, indexes); + if(matches.filter((m)=>m.index < i).length % 2 !== 0) return match; + + // matches = []; + // while (test = inlineCodeBlock.exec(rawBrewText)) { + // matches.push(test); + // } + // console.log(matches, match, i); + // if(matches.filter((m)=>m.index < i).length % 2 !== 0) return match; + + return `${`
`.repeat(match.length)}\n`; + }); return Markdown( sanatizeScriptTags(rawBrewText), { renderer: renderer } From fd23396b955af37d2fe1605c76b73d4aee1f2bda Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Wed, 15 Dec 2021 23:57:52 -0600 Subject: [PATCH 03/10] Add migrate nav item to pages and update migrate document --- client/homebrew/navbar/migrate.navitem.jsx | 13 ++ client/homebrew/navbar/navbar.less | 7 +- client/homebrew/pages/editPage/editPage.jsx | 2 + client/homebrew/pages/errorPage/errorPage.jsx | 2 + client/homebrew/pages/homePage/homePage.jsx | 2 + client/homebrew/pages/homePage/migrate.md | 202 ++++++++++++++++++ client/homebrew/pages/homePage/migrate_gmb.md | 169 --------------- client/homebrew/pages/newPage/newPage.jsx | 2 + server.js | 8 +- shared/naturalcrit/markdown.js | 19 +- 10 files changed, 233 insertions(+), 193 deletions(-) create mode 100644 client/homebrew/navbar/migrate.navitem.jsx create mode 100644 client/homebrew/pages/homePage/migrate.md delete mode 100644 client/homebrew/pages/homePage/migrate_gmb.md diff --git a/client/homebrew/navbar/migrate.navitem.jsx b/client/homebrew/navbar/migrate.navitem.jsx new file mode 100644 index 000000000..d0ac086d3 --- /dev/null +++ b/client/homebrew/navbar/migrate.navitem.jsx @@ -0,0 +1,13 @@ +const React = require('react'); +const Nav = require('naturalcrit/nav/nav.jsx'); + +module.exports = function(props){ + return + migrate + ; +}; diff --git a/client/homebrew/navbar/navbar.less b/client/homebrew/navbar/navbar.less index 36cbdf935..37c28f3e8 100644 --- a/client/homebrew/navbar/navbar.less +++ b/client/homebrew/navbar/navbar.less @@ -1,5 +1,5 @@ @navbarHeight : 28px; -@keyframes coloring { +@keyframes pinkColoring { //from {color: white;} //to {color: red;} 0% {color: pink;} @@ -62,11 +62,14 @@ } i{ .animate(color); - animation-name: coloring; + animation-name: pinkColoring; animation-duration: 2s; color: pink; } } + .migrate.navItem{ + border-right : 1px solid #666; + } .recent.navItem{ position : relative; .dropdown{ diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index ee4f41f5b..c73e59bd7 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -23,6 +23,7 @@ const Markdown = require('naturalcrit/markdown.js'); const googleDriveActive = require('../../googleDrive.png'); const googleDriveInactive = require('../../googleDriveMono.png'); +const MigrateNavItem = require("../../navbar/migrate.navitem.jsx"); const SAVE_TIMEOUT = 3000; @@ -433,6 +434,7 @@ const EditPage = createClass({ {this.renderGoogleDriveIcon()} {this.renderSaveButton()} + diff --git a/client/homebrew/pages/errorPage/errorPage.jsx b/client/homebrew/pages/errorPage/errorPage.jsx index aa51c83be..fe4473dc7 100644 --- a/client/homebrew/pages/errorPage/errorPage.jsx +++ b/client/homebrew/pages/errorPage/errorPage.jsx @@ -11,6 +11,7 @@ const IssueNavItem = require('../../navbar/issue.navitem.jsx'); const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx'); +const MigrateNavItem = require("../../navbar/migrate.navitem.jsx"); const ErrorPage = createClass({ getDefaultProps : function() { @@ -33,6 +34,7 @@ const ErrorPage = createClass({ + diff --git a/client/homebrew/pages/homePage/homePage.jsx b/client/homebrew/pages/homePage/homePage.jsx index c46d451eb..f7384285d 100644 --- a/client/homebrew/pages/homePage/homePage.jsx +++ b/client/homebrew/pages/homePage/homePage.jsx @@ -10,6 +10,7 @@ const Nav = require('naturalcrit/nav/nav.jsx'); const Navbar = require('../../navbar/navbar.jsx'); const NewBrewItem = require('../../navbar/newbrew.navitem.jsx'); const IssueNavItem = require('../../navbar/issue.navitem.jsx'); +const MigrateNavItem = require('../../navbar/migrate.navitem.jsx'); const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; const AccountNavItem = require('../../navbar/account.navitem.jsx'); @@ -58,6 +59,7 @@ const HomePage = createClass({ return + diff --git a/client/homebrew/pages/homePage/migrate.md b/client/homebrew/pages/homePage/migrate.md new file mode 100644 index 000000000..9624fef6c --- /dev/null +++ b/client/homebrew/pages/homePage/migrate.md @@ -0,0 +1,202 @@ +# How to Convert a Legacy Document to v3 +Here you will find a number of steps to guide you through converting a Legacy document into a Homebrewery v3 document. + +**The first thing you'll want to do is switch the editor's rendering engine from `Legacy` to `v3`.** This will be the renderer we design features for moving forward. + +There are some examples of Legacy code in the code pane if you need more context behind some of the changes. + +**This document will evolve as users like yourself inform us of issues with it, or areas of conversion that it does not cover. _Please_ reach out if you have any suggestions for this document.** + +## Simple Replacements +To make your life a little easier with this section, a text editor like [VSCode](https://code.visualstudio.com/) or Notepad will help a lot. + +The following table describes Legacy and other document elements and their Homebrewery counterparts. A simple find/replace should get these in working order. + +| Legacy / Other | Homebrewery | +|:----------------|:-----------------------------| +| `\pagebreak` | `\page` | +| `======` | `\page` | +| `\pagebreaknum` | `{{pageNumber,auto}}\n\page` | +| `@=====` | `{{pageNumber,auto}}\n\page` | +| `\columnbreak` | `\column` | +| `.phb` | `.page` | + +## Classed or Styled Divs +Anything that relies on the following syntax can be changed to the new Homebrewery v3 curly brace syntax: + +``` +
+... +
+``` +: +The above example is equivalent to the following in v3 syntax. + +``` +{{classTable,wide +... +}} +``` +: +Some examples of this include class tables (as shown above), descriptive blocks, notes, and spell lists. + +\column + +## Margins and Padding +Any manual margins and padding to push text down the page will likely need to be updated. Colons can be used on lines by themselves to push things down the page vertically if you'd rather not set pixel-perfect margins or padding. + +## Notes + +In Legacy, notes are denoted using markdown blockquote syntax. In Homebrewery v3, this is replaced by the curly brace syntax. + + + +{{note +##### Title +Information +}} + +## Split Tables +Split tables also use the curly brace syntax, as the new renderer can handle style values separately from class names. + + + +##### Typical Difficulty Classes +{{column-count:2 +| Task Difficulty | DC | +|:----------------|:--:| +| Very easy | 5 | +| Easy | 10 | +| Medium | 15 | + +| Task Difficulty | DC | +|:------------------|:--:| +| Hard | 20 | +| Very hard | 25 | +| Nearly impossible | 30 | +}} + +## Blockquotes +Blockquotes are denoted by the `>` character at the beginning of the line. In Homebrewery's v3 renderer, they hold virtually no meaning and have no CSS styling. You are free to use blockquotes when styling your document or creating themes without needing to worry about your CSS affecting other parts of the document. + +{{pageNumber,auto}} + +\page + +## Stat Blocks + +There are pretty significant differences between stat blocks on the Legacy renderer and Homebrewery v3. This section contains a list of changes that will need to be made to update the stat block. + +### Initial Changes +You will want to **remove all leading** `___` that started the stat block in Legacy, and replace that with `{{monster` before the stat block, and `}}` after it. + +**If you want a frame** around the stat block, you can add `,frame` to the curly brace definition. + +**If the stat block was wide**, make sure to add `,wide` to the curly brace definition. + +### Blockquotes +The key difference is the lack of blockquotes. Legacy documents use the `>` symbol at the start of the line for each line in the stat block, and the v3 renderer does not. **You will want to remove all `>` characters at the beginning of all lines, and delete any leading spaces.** + +### Lists +The basic characteristics and advanced characteristics sections are not list elements in Homebrewery. You will want to **remove all `-` or `*` characters from the beginning of lines.** + +### Spacing +In order to have the correct spacing after removing the list elements, you will want to **add two colons between the name of each basic/advanced characteristic and its value.** _(see example in the code pane)_ + +Additionally, in the special traits and actions sections, you will want to add a colon at the beginning of each line that separates a trait/action from another, as seen below. **Any empty lines between special traits and actions should contain only a colon.** _(see example in the code pane)_ + +\column + +{{margin-top:102px}} + + + +### Homebrewery example: + +{{monster +## Centaur +*Large monstrosity, neutral good* +___ +**Armor Class** :: 12 +**Hit Points** :: 45(6d10 + 12) +**Speed** :: 50ft. +___ +| STR | DEX | CON | INT | WIS | CHA | +|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:| +|18 (+4)|14 (+2)|14 (+2)|9 (-1) |13 (+1)|11 (+0)| +___ +**Skills** :: Athletics +6, Perception +3, Survival +3 +**Senses** :: passive Perception 13 +**Languages** :: Elvish, Sylvan +**Challenge** :: 2 (450 XP) +___ +***Charge.*** If the centaur moves at least 30 feet straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage. +: +***Second Thing*** More details. + +### Actions +***Multiattack.*** The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow. +: +***Pike.*** *Melee Weapon Attack:* +6 to hit, reach 10 ft., one target. *Hit:* 9 (1d10 + 4) piercing damage. +: +***Hooves.*** *Melee Weapon Attack:* +6 to hit, reach 5 ft., one target. *Hit:* 11 (2d6 + 4) bludgeoning damage. +: +***Longbow.*** *Ranged Weapon Attack:* +4 to hit, range 150/600 ft., one target. *Hit:* 6 (1d8 + 2) piercing damage. +}} + +{{pageNumber,auto}} + + + diff --git a/client/homebrew/pages/homePage/migrate_gmb.md b/client/homebrew/pages/homePage/migrate_gmb.md deleted file mode 100644 index 5a70452df..000000000 --- a/client/homebrew/pages/homePage/migrate_gmb.md +++ /dev/null @@ -1,169 +0,0 @@ -# How to Convert a GMBinder Document to Homebrewery -Here you will find a number of steps to guide you through converting a GMBinder document into a Homebrewery document. - -**This document will evolve as users like yourself inform us of issues with it, or areas of conversion that it does not cover. _Please_ reach out if you have any suggestions for this document.** - -The first thing you'll want to do is switch the editor's rendering engine from `Legacy` to `v3`. This will be the renderer we design features for moving forward. - -### Simple Text Replacements -To make your life a little easier with this section, we recommend using a text editor like [VSCode](https://code.visualstudio.com/) or Notepad. - -The following table describes GMBinder elements and their Homebrewery counterparts. A simple find/replace should get these in working order. - -| GMBinder | Homebrewery | -|:----------------|:---| -| `\pagebreak` | `\page` | -| `======` | `\page` | -| `\pagebreaknum` | `{{pageNumber,auto}}\n\page` | -| `@=====` | `{{pageNumber,auto}}\n\page` | -| `\columnbreak` | `\column` | -| `.phb` | `.page` | - -### Margins and Padding -Any manual margins and padding to push text down the page will likely need to be updated. Something to note is immediately after a column break - -\page - -## Stat Blocks - -{{wide -There are pretty significant differences between stat blocks on GMBinder and Homebrewery. In this section we will describe a list of find/replace commands you can run against your GMB stat block to help make migrating them easier. -}} - -### GMBinder Example: - -``` -___ -> ## Centaur -> *Large Monstrosity, neutral good* ->___ -> - **Armor Class** 12 -> - **Hit Points** 45(6d10 + 12) -> - **Speed** 50ft. ->___ ->|STR|DEX|CON|INT|WIS|CHA| ->|:---:|:---:|:---:|:---:|:---:|:---:| ->|18 (+4)|14 (+2)|14 (+2)|9 (-1)|13 (+1)|11 (+0)| ->___ -> - **Skills** Athletics +6, Perception +3, Survival +3 -> - **Senses** passive Perception 13 -> - **Languages** Elvish, Sylvan -> - **Challenge** 2 (450 XP) -> ___ -> ***Charge.*** If the centaur moves at least 30 feet straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage. -> -> ***Second Thing*** More details. -> -> ### Actions -> ***Multiattack.*** The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow. -> -> ***Pike.*** *Melee Weapon Attack:* +6 to hit, reach 10 ft., one target. *Hit:* 9 (1d10 + 4) piercing damage. -> -> ***Hooves.*** *Melee Weapon Attack:* +6 to hit, reach 5 ft., one target. *Hit:* 11 (2d6 + 4) bludgeoning damage. -> -> ***Longbow.*** *Ranged Weapon Attack:* +4 to hit, range 150/600 ft., one target. *Hit:* 6 (1d8 + 2) piercing damage. -``` - -\column - -### Homebrewery example: - -``` -{{monster -## Centaur -*Large monstrosity, neutral good* -___ -**Armor Class** :: 12 -**Hit Points** :: 45(6d10 + 12) -**Speed** :: 50ft. -___ -| STR | DEX | CON | INT | WIS | CHA | -|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:| -|18 (+4)|14 (+2)|14 (+2)|9 (-1) |13 (+1)|11 (+0)| -___ -**Skills** :: Athletics +6, Perception +3, Survival +3 -**Senses** :: passive Perception 13 -**Languages** :: Elvish, Sylvan -**Challenge** :: 2 (450 XP) -___ -***Charge.*** If the centaur moves at least 30 feet straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage. -: -***Second Thing*** More details. - -### Actions -***Multiattack.*** The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow. -: -***Pike.*** *Melee Weapon Attack:* +6 to hit, reach 10 ft., one target. *Hit:* 9 (1d10 + 4) piercing damage. -: -***Hooves.*** *Melee Weapon Attack:* +6 to hit, reach 5 ft., one target. *Hit:* 11 (2d6 + 4) bludgeoning damage. -: -***Longbow.*** *Ranged Weapon Attack:* +4 to hit, range 150/600 ft., one target. *Hit:* 6 (1d8 + 2) piercing damage. -}} -``` - -\page - -{{monster -## Centaur -*Large monstrosity, neutral good* -___ -**Armor Class** :: 12 -**Hit Points** :: 45(6d10 + 12) -**Speed** :: 50ft. -___ -| STR | DEX | CON | INT | WIS | CHA | -|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:| -|18 (+4)|14 (+2)|14 (+2)|9 (-1) |13 (+1)|11 (+0)| -___ -**Skills** :: Athletics +6, Perception +3, Survival +3 -**Senses** :: passive Perception 13 -**Languages** :: Elvish, Sylvan -**Challenge** :: 2 (450 XP) -___ -***Charge.*** If the centaur moves at least 30 feet straight toward a target and then hits it with a pike attack on the same turn, the target takes an extra 10 (3d6) piercing damage. -: -***Second Thing*** More details. - -### Actions -***Multiattack.*** The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow. -: -***Pike.*** *Melee Weapon Attack:* +6 to hit, reach 10 ft., one target. *Hit:* 9 (1d10 + 4) piercing damage. -: -***Hooves.*** *Melee Weapon Attack:* +6 to hit, reach 5 ft., one target. *Hit:* 11 (2d6 + 4) bludgeoning damage. -: -***Longbow.*** *Ranged Weapon Attack:* +4 to hit, range 150/600 ft., one target. *Hit:* 6 (1d8 + 2) piercing damage. -}} - -\column - -**Use these find/replace commands in the order listed for the best result.** - -#### Blockquotes -The key difference is the lack of blockquotes. GMBinder uses the `>` symbol at the start of the line for each line in the stat block, and Homebrewery's v3 renderer does not. **You will want to remove all `>` characters at the beginning of all lines, and delete any leading spaces.** - -#### Lists -The basic characteristics and advanced characteristics sections are not list elements in Homebrewery. **You will want to remove all `-` or `*` characters from the beginning of lines.** - -#### Spacing -In order to have the correct spacing after removing the list elements, **you will want to add two colons (`::`) between the name of each basic/advanced characteristic and its value.** i.e: -``` -**Skills** :: Athletics +6 -``` - -: - -Additionally, in the special traits and actions sections, you will want to add a colon at the beginning of each line that separates a trait/action from another, as seen below. **Any empty lines between special traits and actions should contain only a colon.** - -``` -### Actions -***Multiattack.*** The centaur makes two attacks: one with its pike and one with its hooves or two with its longbow. -: -***Pike.*** *Melee Weapon Attack:* +6 to hit, reach 10 ft., one target. *Hit:* 9 (1d10 + 4) piercing damage. -``` - -: - -#### Final Notes -Lastly you will want to remove the leading `___` that started the stat block in GMBinder, and replace that with `{{monster` before the stat block, and `}}` after it. If you want a frame around the stat block, you can use `{{monster,frame` instead. - - diff --git a/client/homebrew/pages/newPage/newPage.jsx b/client/homebrew/pages/newPage/newPage.jsx index 3f09cac4e..04b0be723 100644 --- a/client/homebrew/pages/newPage/newPage.jsx +++ b/client/homebrew/pages/newPage/newPage.jsx @@ -16,6 +16,7 @@ const IssueNavItem = require('../../navbar/issue.navitem.jsx'); const SplitPane = require('naturalcrit/splitPane/splitPane.jsx'); const Editor = require('../../editor/editor.jsx'); const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx'); +const MigrateNavItem = require("../../navbar/migrate.navitem.jsx"); const BREWKEY = 'homebrewery-new'; const STYLEKEY = 'homebrewery-new-style'; @@ -290,6 +291,7 @@ const NewPage = createClass({ {this.renderSaveButton()} {this.renderLocalPrintButton()} + diff --git a/server.js b/server.js index f68c326ae..2ea8f305b 100644 --- a/server.js +++ b/server.js @@ -103,7 +103,7 @@ app.use(require('./server/admin.api.js')); const HomebrewModel = require('./server/homebrew.model.js').model; const welcomeText = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg.md', 'utf8'); const welcomeTextV3 = require('fs').readFileSync('./client/homebrew/pages/homePage/welcome_msg_v3.md', 'utf8'); -const migrateGMBText = require('fs').readFileSync('./client/homebrew/pages/homePage/migrate_gmb.md', 'utf8'); +const migrateText = require('fs').readFileSync('./client/homebrew/pages/homePage/migrate.md', 'utf8'); const changelogText = require('fs').readFileSync('./changelog.md', 'utf8'); const faqText = require('fs').readFileSync('./faq.md', 'utf8'); @@ -134,10 +134,10 @@ app.get('/v3_preview', async (req, res, next)=>{ return next(); }); -//GMBinder Migration Guide -app.get('/migrate-from-gmb', async (req, res, next)=>{ +//Legacy/Other Document -> v3 Migration Guide +app.get('/migrate', async (req, res, next)=>{ const brew = { - text : migrateGMBText, + text : migrateText, renderer : 'V3' }; splitTextAndStyle(brew); diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 10e92eb4e..52fc4c352 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -535,24 +535,7 @@ module.exports = { marked : Markdown, render : (rawBrewText)=>{ rawBrewText = rawBrewText.replace(/^\\column$/gm, `\n
\n`) - .replace(/^(:+)$/gm, (match, _, i)=>{ - let test, matches=[]; - const codeBlock = /`/gm, inlineCodeBlock = /[^`]`[^`]/g; - while (test = codeBlock.exec(rawBrewText)) { - matches.push(test); - } - // console.log(match, m, i, indexes); - if(matches.filter((m)=>m.index < i).length % 2 !== 0) return match; - - // matches = []; - // while (test = inlineCodeBlock.exec(rawBrewText)) { - // matches.push(test); - // } - // console.log(matches, match, i); - // if(matches.filter((m)=>m.index < i).length % 2 !== 0) return match; - - return `${`
`.repeat(match.length)}\n`; - }); + .replace(/^(:+)$/gm, (match)=>`${`
`.repeat(match.length)}\n`); return Markdown( sanatizeScriptTags(rawBrewText), { renderer: renderer } From 889d3073720763d23ff4e57f1951baaf1a05d990 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Wed, 15 Dec 2021 23:58:49 -0600 Subject: [PATCH 04/10] Lint change double quotes into single quotes --- client/homebrew/pages/editPage/editPage.jsx | 2 +- client/homebrew/pages/errorPage/errorPage.jsx | 2 +- client/homebrew/pages/newPage/newPage.jsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index c73e59bd7..9b2a48aae 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -23,7 +23,7 @@ const Markdown = require('naturalcrit/markdown.js'); const googleDriveActive = require('../../googleDrive.png'); const googleDriveInactive = require('../../googleDriveMono.png'); -const MigrateNavItem = require("../../navbar/migrate.navitem.jsx"); +const MigrateNavItem = require('../../navbar/migrate.navitem.jsx'); const SAVE_TIMEOUT = 3000; diff --git a/client/homebrew/pages/errorPage/errorPage.jsx b/client/homebrew/pages/errorPage/errorPage.jsx index fe4473dc7..2b7aef8aa 100644 --- a/client/homebrew/pages/errorPage/errorPage.jsx +++ b/client/homebrew/pages/errorPage/errorPage.jsx @@ -11,7 +11,7 @@ const IssueNavItem = require('../../navbar/issue.navitem.jsx'); const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx'); -const MigrateNavItem = require("../../navbar/migrate.navitem.jsx"); +const MigrateNavItem = require('../../navbar/migrate.navitem.jsx'); const ErrorPage = createClass({ getDefaultProps : function() { diff --git a/client/homebrew/pages/newPage/newPage.jsx b/client/homebrew/pages/newPage/newPage.jsx index 04b0be723..18a090b3d 100644 --- a/client/homebrew/pages/newPage/newPage.jsx +++ b/client/homebrew/pages/newPage/newPage.jsx @@ -16,7 +16,7 @@ const IssueNavItem = require('../../navbar/issue.navitem.jsx'); const SplitPane = require('naturalcrit/splitPane/splitPane.jsx'); const Editor = require('../../editor/editor.jsx'); const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx'); -const MigrateNavItem = require("../../navbar/migrate.navitem.jsx"); +const MigrateNavItem = require('../../navbar/migrate.navitem.jsx'); const BREWKEY = 'homebrewery-new'; const STYLEKEY = 'homebrewery-new-style'; From 25c1d03ccad3ab9c6f8465eb2f7791ac821c6d84 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Wed, 15 Dec 2021 23:59:36 -0600 Subject: [PATCH 05/10] Update package-lock.json --- package-lock.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package-lock.json b/package-lock.json index a8ad026b8..0298d92f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "homebrewery", "version": "3.0.5", "hasInstallScript": true, "license": "MIT", From 0bc27e83edf0d62ca8cfc3e4ce95cfc7c6289f1a Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Thu, 16 Dec 2021 00:01:16 -0600 Subject: [PATCH 06/10] Fix reference to old function --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 88598f9a3..9812af38d 100644 --- a/server.js +++ b/server.js @@ -148,7 +148,7 @@ app.get('/migrate', async (req, res, next)=>{ text : migrateText, renderer : 'V3' }; - splitTextAndStyle(brew); + splitTextStyleAndMetadata(brew); req.brew = brew; return next(); }); From 603cf2c0abb54c6157e75c8faa45e1eb76a9ed22 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Thu, 16 Dec 2021 00:03:23 -0600 Subject: [PATCH 07/10] Adjust migrate document text --- client/homebrew/pages/homePage/migrate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/pages/homePage/migrate.md b/client/homebrew/pages/homePage/migrate.md index 9624fef6c..822e97ef0 100644 --- a/client/homebrew/pages/homePage/migrate.md +++ b/client/homebrew/pages/homePage/migrate.md @@ -163,7 +163,7 @@ ___ > ***Longbow.*** *Ranged Weapon Attack:* +4 to hit, range 150/600 ft., one target. *Hit:* 6 (1d8 + 2) piercing damage. --> -### Homebrewery example: +### Homebrewery v3 Example: {{monster ## Centaur From 38c0527d35dfa00a6e4acd3c369370ca55b62b35 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Wed, 26 Jan 2022 08:40:33 -0600 Subject: [PATCH 08/10] Add color mixins, help dropdown, and remove unused nav items --- client/homebrew/navbar/help.navitem.jsx | 49 +++++++++++++++++++ client/homebrew/navbar/issue.navitem.jsx | 13 ----- client/homebrew/navbar/migrate.navitem.jsx | 13 ----- client/homebrew/navbar/navbar.less | 25 ++++++---- client/homebrew/navbar/recent.navitem.jsx | 4 +- client/homebrew/pages/editPage/editPage.jsx | 6 +-- client/homebrew/pages/errorPage/errorPage.jsx | 6 +-- client/homebrew/pages/homePage/homePage.jsx | 6 +-- client/homebrew/pages/newPage/newPage.jsx | 6 +-- client/homebrew/pages/userPage/userPage.jsx | 4 +- shared/naturalcrit/nav/nav.less | 22 +-------- shared/naturalcrit/styles/colors.less | 25 +++++++++- 12 files changed, 102 insertions(+), 77 deletions(-) create mode 100644 client/homebrew/navbar/help.navitem.jsx delete mode 100644 client/homebrew/navbar/issue.navitem.jsx delete mode 100644 client/homebrew/navbar/migrate.navitem.jsx diff --git a/client/homebrew/navbar/help.navitem.jsx b/client/homebrew/navbar/help.navitem.jsx new file mode 100644 index 000000000..7252d03c7 --- /dev/null +++ b/client/homebrew/navbar/help.navitem.jsx @@ -0,0 +1,49 @@ +const React = require('react'); +const createClass = require('create-react-class'); +const _ = require('lodash'); + +const Nav = require('naturalcrit/nav/nav.jsx'); + +const Help = createClass({ + + getInitialState : function() { + return { + showDropdown : false + }; + }, + + handleDropdown : function(show){ + this.setState({ + showDropdown : show + }); + }, + + renderDropdown : function(){ + return !this.state.showDropdown ? null : ; + }, + + render : function(){ + return this.handleDropdown(true)} + onMouseLeave={()=>this.handleDropdown(false)}> + Need Help? + {this.renderDropdown()} + ; + } + +}); + +module.exports = Help; diff --git a/client/homebrew/navbar/issue.navitem.jsx b/client/homebrew/navbar/issue.navitem.jsx deleted file mode 100644 index 529744c29..000000000 --- a/client/homebrew/navbar/issue.navitem.jsx +++ /dev/null @@ -1,13 +0,0 @@ -const React = require('react'); -const createClass = require('create-react-class'); -const Nav = require('naturalcrit/nav/nav.jsx'); - -module.exports = function(props){ - return - report issue - ; -}; diff --git a/client/homebrew/navbar/migrate.navitem.jsx b/client/homebrew/navbar/migrate.navitem.jsx deleted file mode 100644 index d0ac086d3..000000000 --- a/client/homebrew/navbar/migrate.navitem.jsx +++ /dev/null @@ -1,13 +0,0 @@ -const React = require('react'); -const Nav = require('naturalcrit/nav/nav.jsx'); - -module.exports = function(props){ - return - migrate - ; -}; diff --git a/client/homebrew/navbar/navbar.less b/client/homebrew/navbar/navbar.less index 37c28f3e8..b8a032914 100644 --- a/client/homebrew/navbar/navbar.less +++ b/client/homebrew/navbar/navbar.less @@ -1,3 +1,4 @@ +@import 'naturalcrit/styles/colors.less'; @navbarHeight : 28px; @keyframes pinkColoring { //from {color: white;} @@ -67,17 +68,17 @@ color: pink; } } - .migrate.navItem{ - border-right : 1px solid #666; - } - .recent.navItem{ + .recent.navItem, + .help.navItem{ position : relative; .dropdown{ - position : absolute; - top : 28px; - left : 0px; - z-index : 10000; - width : 100%; + position : absolute; + top : 28px; + left : 0px; + z-index : 10000; + width : 100%; + overflow : hidden auto; + max-height : ~"calc(100vh - 28px)"; h4{ display : block; box-sizing : border-box; @@ -91,6 +92,7 @@ &:nth-of-type(2){ background-color: darken(@purple, 30%); } } .item{ + #backgroundColors; .animate(background-color); position : relative; display : block; @@ -104,11 +106,14 @@ background-color : @blue; } .title{ - display : inline-block; overflow : hidden; width : 100%; text-overflow : ellipsis; white-space : nowrap; + + i{ + float: right; + } } .time{ position : absolute; diff --git a/client/homebrew/navbar/recent.navitem.jsx b/client/homebrew/navbar/recent.navitem.jsx index e386d9caf..4e0611b3c 100644 --- a/client/homebrew/navbar/recent.navitem.jsx +++ b/client/homebrew/navbar/recent.navitem.jsx @@ -123,8 +123,8 @@ const RecentItems = createClass({ if(!this.state.showDropdown) return null; const makeItems = (brews)=>{ - return _.map(brews, (brew)=>{ - return + return _.map(brews, (brew, i)=>{ + return {brew.title || '[ no title ]'} {Moment(brew.ts).fromNow()} ; diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index 22db79ff7..89bf51e57 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -10,7 +10,7 @@ const Nav = require('naturalcrit/nav/nav.jsx'); const Navbar = require('../../navbar/navbar.jsx'); const NewBrew = require('../../navbar/newbrew.navitem.jsx'); -const ReportIssue = require('../../navbar/issue.navitem.jsx'); +const HelpNavItem = require('../../navbar/help.navitem.jsx'); const PrintLink = require('../../navbar/print.navitem.jsx'); const Account = require('../../navbar/account.navitem.jsx'); const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; @@ -23,7 +23,6 @@ const Markdown = require('naturalcrit/markdown.js'); const googleDriveActive = require('../../googleDrive.png'); const googleDriveInactive = require('../../googleDriveMono.png'); -const MigrateNavItem = require('../../navbar/migrate.navitem.jsx'); const SAVE_TIMEOUT = 3000; @@ -434,8 +433,7 @@ const EditPage = createClass({ {this.renderGoogleDriveIcon()} {this.renderSaveButton()} - - + share diff --git a/client/homebrew/pages/errorPage/errorPage.jsx b/client/homebrew/pages/errorPage/errorPage.jsx index 2b7aef8aa..560ab5625 100644 --- a/client/homebrew/pages/errorPage/errorPage.jsx +++ b/client/homebrew/pages/errorPage/errorPage.jsx @@ -7,11 +7,10 @@ const cx = require('classnames'); const Nav = require('naturalcrit/nav/nav.jsx'); const Navbar = require('../../navbar/navbar.jsx'); const PatreonNavItem = require('../../navbar/patreon.navitem.jsx'); -const IssueNavItem = require('../../navbar/issue.navitem.jsx'); const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; +const HelpNavItem = require('../../navbar/help.navitem.jsx'); const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx'); -const MigrateNavItem = require('../../navbar/migrate.navitem.jsx'); const ErrorPage = createClass({ getDefaultProps : function() { @@ -34,8 +33,7 @@ const ErrorPage = createClass({ - - +
diff --git a/client/homebrew/pages/homePage/homePage.jsx b/client/homebrew/pages/homePage/homePage.jsx index f7384285d..e95c75c0d 100644 --- a/client/homebrew/pages/homePage/homePage.jsx +++ b/client/homebrew/pages/homePage/homePage.jsx @@ -9,8 +9,7 @@ const { Meta } = require('vitreum/headtags'); const Nav = require('naturalcrit/nav/nav.jsx'); const Navbar = require('../../navbar/navbar.jsx'); const NewBrewItem = require('../../navbar/newbrew.navitem.jsx'); -const IssueNavItem = require('../../navbar/issue.navitem.jsx'); -const MigrateNavItem = require('../../navbar/migrate.navitem.jsx'); +const HelpNavItem = require('../../navbar/help.navitem.jsx'); const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; const AccountNavItem = require('../../navbar/account.navitem.jsx'); @@ -59,8 +58,7 @@ const HomePage = createClass({ return - - + diff --git a/client/homebrew/pages/newPage/newPage.jsx b/client/homebrew/pages/newPage/newPage.jsx index b4529f873..21d1d9dcd 100644 --- a/client/homebrew/pages/newPage/newPage.jsx +++ b/client/homebrew/pages/newPage/newPage.jsx @@ -11,12 +11,11 @@ const Nav = require('naturalcrit/nav/nav.jsx'); const Navbar = require('../../navbar/navbar.jsx'); const AccountNavItem = require('../../navbar/account.navitem.jsx'); const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; -const IssueNavItem = require('../../navbar/issue.navitem.jsx'); +const HelpNavItem = require('../../navbar/help.navitem.jsx'); const SplitPane = require('naturalcrit/splitPane/splitPane.jsx'); const Editor = require('../../editor/editor.jsx'); const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx'); -const MigrateNavItem = require('../../navbar/migrate.navitem.jsx'); const BREWKEY = 'homebrewery-new'; const STYLEKEY = 'homebrewery-new-style'; @@ -291,8 +290,7 @@ const NewPage = createClass({ {this.renderSaveButton()} {this.renderLocalPrintButton()} - - + diff --git a/client/homebrew/pages/userPage/userPage.jsx b/client/homebrew/pages/userPage/userPage.jsx index 3ef0d0340..aa9860128 100644 --- a/client/homebrew/pages/userPage/userPage.jsx +++ b/client/homebrew/pages/userPage/userPage.jsx @@ -13,7 +13,7 @@ const RecentNavItem = require('../../navbar/recent.navitem.jsx').both; const Account = require('../../navbar/account.navitem.jsx'); const NewBrew = require('../../navbar/newbrew.navitem.jsx'); const BrewItem = require('./brewItem/brewItem.jsx'); -const ReportIssue = require('../../navbar/issue.navitem.jsx'); +const HelpNavItem = require('../../navbar/help.navitem.jsx'); // const brew = { // title : 'SUPER Long title woah now', @@ -163,7 +163,7 @@ const UserPage = createClass({ - + diff --git a/shared/naturalcrit/nav/nav.less b/shared/naturalcrit/nav/nav.less index fea4c1c8b..02e890dea 100644 --- a/shared/naturalcrit/nav/nav.less +++ b/shared/naturalcrit/nav/nav.less @@ -1,3 +1,4 @@ +@import '../styles/colors'; @keyframes glideDropDown { 0% {transform : translate(0px, -100%); opacity : 0; @@ -49,6 +50,7 @@ nav{ } } .navItem{ + #backgroundColors; .animate(background-color); padding : 8px 12px; cursor : pointer; @@ -62,26 +64,6 @@ nav{ margin-left : 5px; font-size : 13px; } - &.tealLight:hover{ background-color : @tealLight }; - &.teal:hover{ background-color : @teal }; - &.greenLight:hover{ background-color : @greenLight }; - &.green:hover{ background-color : @green }; - &.blueLight:hover{ background-color : @blueLight }; - &.blue:hover{ background-color : @blue }; - &.purpleLight:hover{ background-color : @purpleLight }; - &.purple:hover{ background-color : @purple }; - &.steelLight:hover{ background-color : @steelLight }; - &.steel:hover{ background-color : @steel }; - &.yellowLight:hover{ background-color : @yellowLight }; - &.yellow:hover{ background-color : @yellow }; - &.orangeLight:hover{ background-color : @orangeLight }; - &.orange:hover{ background-color : @orange }; - &.redLight:hover{ background-color : @redLight }; - &.red:hover{ background-color : @red }; - &.silverLight:hover{ background-color : @silverLight }; - &.silver:hover{ background-color : @silver }; - &.greyLight:hover{ background-color : @greyLight }; - &.grey:hover{ background-color : @grey }; } .navSection:last-child .navItem{ border-left : 1px solid #666; diff --git a/shared/naturalcrit/styles/colors.less b/shared/naturalcrit/styles/colors.less index 4fea42bc3..340fb38a7 100644 --- a/shared/naturalcrit/styles/colors.less +++ b/shared/naturalcrit/styles/colors.less @@ -20,4 +20,27 @@ @silverLight : #ECF0F1; @silver : #BDC3C7; @greyLight : #95A5A6; -@grey : #7F8C8D; \ No newline at end of file +@grey : #7F8C8D; + +#backgroundColors { + &.tealLight:hover{ background-color : @tealLight }; + &.teal:hover{ background-color : @teal }; + &.greenLight:hover{ background-color : @greenLight }; + &.green:hover{ background-color : @green }; + &.blueLight:hover{ background-color : @blueLight }; + &.blue:hover{ background-color : @blue }; + &.purpleLight:hover{ background-color : @purpleLight }; + &.purple:hover{ background-color : @purple }; + &.steelLight:hover{ background-color : @steelLight }; + &.steel:hover{ background-color : @steel }; + &.yellowLight:hover{ background-color : @yellowLight }; + &.yellow:hover{ background-color : @yellow }; + &.orangeLight:hover{ background-color : @orangeLight }; + &.orange:hover{ background-color : @orange }; + &.redLight:hover{ background-color : @redLight }; + &.red:hover{ background-color : @red }; + &.silverLight:hover{ background-color : @silverLight }; + &.silver:hover{ background-color : @silver }; + &.greyLight:hover{ background-color : @greyLight }; + &.grey:hover{ background-color : @grey }; +} \ No newline at end of file From e614fbc5a18b3c98c802277848165a6e2b64efd3 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Wed, 26 Jan 2022 08:46:45 -0600 Subject: [PATCH 09/10] Update app.js from master --- server/app.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/app.js b/server/app.js index c36533b9b..0b7228811 100644 --- a/server/app.js +++ b/server/app.js @@ -101,6 +101,7 @@ app.use(require('./admin.api.js')); const HomebrewModel = require('./homebrew.model.js').model; const welcomeText = require('fs').readFileSync('./../client/homebrew/pages/homePage/welcome_msg.md', 'utf8'); const welcomeTextV3 = require('fs').readFileSync('./../client/homebrew/pages/homePage/welcome_msg_v3.md', 'utf8'); +const migrateText = require('fs').readFileSync('./../client/homebrew/pages/homePage/migrate.md', 'utf8'); const changelogText = require('fs').readFileSync('./../changelog.md', 'utf8'); const faqText = require('fs').readFileSync('./../faq.md', 'utf8'); @@ -131,6 +132,17 @@ app.get('/v3_preview', async (req, res, next)=>{ return next(); }); +//Legacy/Other Document -> v3 Migration Guide +app.get('/migrate', async (req, res, next)=>{ + const brew = { + text : migrateText, + renderer : 'V3' + }; + splitTextStyleAndMetadata(brew); + req.brew = brew; + return next(); +}); + //Changelog page app.get('/changelog', async (req, res, next)=>{ const brew = { From 6bf4fc6cf87a950302cda5c810fd6e491884da64 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Tue, 1 Feb 2022 00:02:46 -0500 Subject: [PATCH 10/10] Help dropdown uses existing dropdown class. Small tweaks. --- client/homebrew/navbar/help.navitem.jsx | 62 ++++++++----------------- client/homebrew/navbar/navbar.less | 10 ++-- shared/naturalcrit/nav/nav.less | 2 + 3 files changed, 24 insertions(+), 50 deletions(-) diff --git a/client/homebrew/navbar/help.navitem.jsx b/client/homebrew/navbar/help.navitem.jsx index 7252d03c7..b4be18319 100644 --- a/client/homebrew/navbar/help.navitem.jsx +++ b/client/homebrew/navbar/help.navitem.jsx @@ -4,46 +4,22 @@ const _ = require('lodash'); const Nav = require('naturalcrit/nav/nav.jsx'); -const Help = createClass({ - - getInitialState : function() { - return { - showDropdown : false - }; - }, - - handleDropdown : function(show){ - this.setState({ - showDropdown : show - }); - }, - - renderDropdown : function(){ - return !this.state.showDropdown ? null : ; - }, - - render : function(){ - return this.handleDropdown(true)} - onMouseLeave={()=>this.handleDropdown(false)}> - Need Help? - {this.renderDropdown()} - ; - } - -}); - -module.exports = Help; +module.exports = function(props){ + return + + need help? + + + report issue + + + migrate + + ; +}; diff --git a/client/homebrew/navbar/navbar.less b/client/homebrew/navbar/navbar.less index b8a032914..a149307e8 100644 --- a/client/homebrew/navbar/navbar.less +++ b/client/homebrew/navbar/navbar.less @@ -68,8 +68,7 @@ color: pink; } } - .recent.navItem, - .help.navItem{ + .recent.navItem { position : relative; .dropdown{ position : absolute; @@ -97,7 +96,7 @@ position : relative; display : block; box-sizing : border-box; - padding : 13px 5px; + padding : 8px 5px 13px; background-color : #333; color : white; text-decoration : none; @@ -106,14 +105,11 @@ background-color : @blue; } .title{ + display : inline-block; overflow : hidden; width : 100%; text-overflow : ellipsis; white-space : nowrap; - - i{ - float: right; - } } .time{ position : absolute; diff --git a/shared/naturalcrit/nav/nav.less b/shared/naturalcrit/nav/nav.less index 02e890dea..f84d11733 100644 --- a/shared/naturalcrit/nav/nav.less +++ b/shared/naturalcrit/nav/nav.less @@ -60,9 +60,11 @@ nav{ color : white; text-decoration : none; text-transform : uppercase; + line-height : 13px; i{ margin-left : 5px; font-size : 13px; + float : right; } } .navSection:last-child .navItem{