Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
rpg-workshop
Commits
ea1f3806
Commit
ea1f3806
authored
Oct 07, 2021
by
Joe Ziemba
Browse files
refactor to components
parent
f7c15dea
Changes
41
Hide whitespace changes
Inline
Side-by-side
src/App.js
View file @
ea1f3806
...
...
@@ -7,7 +7,7 @@ import { UserContext } from "context"
import
{
CharacterBuilder
,
Home
,
StatblockGenerator
}
from
"
views
"
import
{
TopBar
}
from
"
_globalC
omponents
"
import
{
TopBar
}
from
"
c
omponents
"
import
{
firebase
}
from
"
services/Firebase
"
import
{
RedesignAnnounceModal
}
from
"
PF2CharacterBuilder/_modals/RedesignAnnounceModal
"
...
...
src/PF2CharacterBuilder/_components/FeatEntry.js
View file @
ea1f3806
...
...
@@ -19,7 +19,7 @@ const FeatEntry = (props) => {
)
:
(
<
div
className
=
"
grid grid-cols-8 gap 2
"
>
<
span
className
=
"
text-lg col-span-1 text-gray-400 pl-2
"
>
s
{
props
.
label
}
{
props
.
label
}
<
/span
>
<
span
className
=
"
col-span-6
"
>
<
p
className
=
"
text-lg mb-1
"
>
{
props
.
feat
.
name
}
<
/p
>
...
...
src/PF2CharacterBuilder/_components/FeatsSection.js
View file @
ea1f3806
import
React
,
{
useState
,
useEffect
,
useContext
}
from
"
react
"
import
FeatEntry
from
"
./FeatEntry
"
import
FeatSelection
from
"
./FeatSelection
"
import
{
Modal
}
from
"
_globalC
omponents
"
import
{
Modal
}
from
"
c
omponents
"
import
{
Card
}
from
"
./Card
"
import
{
SubHeading
}
from
"
./SubHeading
"
import
{
PlaceholderText
}
from
"
./PlaceholderText
"
...
...
src/PF2CharacterBuilder/_components/SubNav.js
View file @
ea1f3806
...
...
@@ -2,7 +2,7 @@ import React from "react"
import
{
toast
}
from
"
react-toastify
"
import
{
UserContext
}
from
"
context
"
import
{
firebase
}
from
"
services/Firebase
"
import
{
Modal
,
NavButton
,
OpenOrDeleteItem
}
from
"
_globalC
omponents
"
import
{
Modal
,
NavButton
,
OpenOrDeleteItem
}
from
"
c
omponents
"
class
SubNav
extends
React
.
Component
{
constructor
(
props
)
{
...
...
src/PF2CharacterBuilder/_modals/NewFeatureModal.js
View file @
ea1f3806
import
React
,
{
useEffect
,
useState
}
from
"
react
"
import
{
Modal
}
from
"
_globalC
omponents
"
import
{
Modal
}
from
"
c
omponents
"
const
NewFeatureModal
=
()
=>
{
const
[
show
,
setShow
]
=
useState
(
false
)
...
...
src/PF2CharacterBuilder/_modals/RedesignAnnounceModal.js
View file @
ea1f3806
import
React
,
{
useLayoutEffect
,
useState
}
from
"
react
"
import
{
Modal
}
from
"
_globalC
omponents
"
import
{
Modal
}
from
"
c
omponents
"
import
cn
from
"
classnames
"
export
const
RedesignAnnounceModal
=
()
=>
{
...
...
src/StatblockGenerator/FormSections/AbilityScoresForm.js
View file @
ea1f3806
import
React
,
{
useContext
}
from
"
react
"
import
{
Select
Field
}
from
"
_globalC
omponents
"
import
{
SBG_
Select
}
from
"
c
omponents
"
import
{
StatblockContext
}
from
"
context
"
export
const
AbilityScoresForm
=
()
=>
{
...
...
@@ -10,7 +10,7 @@ export const AbilityScoresForm = () => {
{
abilities
.
map
((
ability
)
=>
{
return
(
<
div
className
=
"
col-span-1
"
key
=
{
ability
}
>
<
Select
Field
<
SBG_
Select
label
=
{
ability
.
toUpperCase
()}
options
=
{
global
.
abilityScores
}
value
=
{
stats
.
abilities
[
ability
]}
...
...
src/StatblockGenerator/FormSections/BasicsForm.js
View file @
ea1f3806
import
React
,
{
useContext
}
from
"
react
"
import
{
Column
,
Input
,
Row
,
Select
Field
}
from
"
_globalC
omponents
"
import
{
SBG_
Input
,
SBG_
Select
}
from
"
c
omponents
"
import
{
StatblockContext
}
from
"
context
"
export
const
BasicsForm
=
()
=>
{
...
...
@@ -7,7 +7,7 @@ export const BasicsForm = () => {
useContext
(
StatblockContext
)
return
(
<>
<
Input
<
SBG_
Input
type
=
"
text
"
label
=
{
"
Name
"
}
placeholder
=
{
"
Creature Name
"
}
...
...
@@ -16,27 +16,27 @@ export const BasicsForm = () => {
onChange
=
{
updateState
}
/
>
<
Row
className
=
"
mt-2
"
>
<
Column
className
=
"
mr-4
"
>
<
Select
Field
<
div
className
=
"
flex
mt-2
"
>
<
div
className
=
"
flex-1
mr-4
"
>
<
SBG_
Select
label
=
{
"
Size
"
}
options
=
{[
"
Small
"
,
"
Medium
"
,
"
Large
"
,
"
Huge
"
,
"
Gargantuan
"
]}
value
=
{
stats
.
size
}
fieldName
=
"
size
"
onChange
=
{
updateState
}
/
>
<
/
Column
>
<
Column
className
=
"
mr-4
"
>
<
Select
Field
<
/
div
>
<
div
className
=
"
flex-1
mr-4
"
>
<
SBG_
Select
label
=
{
"
Creature Type
"
}
options
=
{
global
.
creatureTypes
}
value
=
{
stats
.
creatureType
}
onChange
=
{
updateState
}
fieldName
=
"
creatureType
"
/>
<
/
Column
>
<
Column
>
<
Input
<
/
div
>
<
div
className
=
"
flex-1
"
>
<
SBG_
Input
type
=
"
number
"
label
=
{
"
Proficiency
"
}
placeholder
=
{
""
}
...
...
@@ -44,13 +44,13 @@ export const BasicsForm = () => {
fieldName
=
"
proficiency
"
onChange
=
{
updateState
}
/
>
<
/
Column
>
<
/
Row
>
<
/
div
>
<
/
div
>
<
Row
className
=
"
mt-2
"
>
<
Column
className
=
"
mr-4
"
>
<
div
className
=
"
flex
mt-2
"
>
<
div
className
=
"
flex-1
mr-4
"
>
<
h4
className
=
"
form-header mb-1 font-bold
"
>
Armor
Class
<
/h4
>
<
Input
<
SBG_
Input
label
=
{
"
Score
"
}
placeholder
=
{
""
}
value
=
{
stats
.
ac
.
score
}
...
...
@@ -58,7 +58,7 @@ export const BasicsForm = () => {
onChange
=
{
updateAC
}
type
=
"
number
"
/>
<
Input
<
SBG_
Input
type
=
"
text
"
label
=
{
"
Support
"
}
placeholder
=
{
""
}
...
...
@@ -67,19 +67,19 @@ export const BasicsForm = () => {
onChange
=
{
updateAC
}
className
=
"
mt-2
"
/>
<
/
Column
>
<
/
div
>
<
Column
className
=
"
mr-4
"
>
<
div
className
=
"
flex-1
mr-4
"
>
<
h4
className
=
"
form-header mb-1
"
>
Hit
Points
<
/h4
>
<
Select
Field
<
SBG_
Select
label
=
{
"
Hit Die
"
}
options
=
{[
4
,
6
,
8
,
10
,
12
,
20
]}
value
=
{
stats
.
hp
.
hitDie
}
fieldName
=
"
hitDie
"
onChange
=
{
updateHP
}
/
>
<
Input
<
SBG_
Input
type
=
"
number
"
label
=
{
"
Number of Dice
"
}
placeholder
=
{
""
}
...
...
@@ -88,10 +88,10 @@ export const BasicsForm = () => {
onChange
=
{
updateHP
}
className
=
"
mt-2
"
/>
<
/
Column
>
<
Column
className
=
"
flex flex-wrap
"
>
<
/
div
>
<
div
className
=
"
flex-1
flex flex-wrap
"
>
<
h4
className
=
"
form-header flex-full mb-1
"
>
Speed
<
/h4
>
<
Input
<
SBG_
Input
type
=
"
number
"
label
=
{
"
Base Speed
"
}
placeholder
=
{
""
}
...
...
@@ -99,9 +99,9 @@ export const BasicsForm = () => {
fieldName
=
"
speed
"
onChange
=
{
updateState
}
/
>
<
Row
>
<
Column
className
=
"
mr-4 mt-2
"
>
<
Input
<
div
className
=
"
flex
"
>
<
div
className
=
"
flex-1
mr-4 mt-2
"
>
<
SBG_
Input
type
=
"
number
"
label
=
{
"
Fly
"
}
placeholder
=
{
""
}
...
...
@@ -109,9 +109,9 @@ export const BasicsForm = () => {
fieldName
=
"
flySpeed
"
onChange
=
{
updateState
}
/
>
<
/
Column
>
<
Column
className
=
"
mt-2
"
>
<
Input
<
/
div
>
<
div
className
=
"
flex-1
mt-2
"
>
<
SBG_
Input
type
=
"
number
"
label
=
{
"
Swim
"
}
placeholder
=
{
""
}
...
...
@@ -119,10 +119,10 @@ export const BasicsForm = () => {
fieldName
=
"
swimSpeed
"
onChange
=
{
updateState
}
/
>
<
/
Column
>
<
/
Row
>
<
/
Column
>
<
/
Row
>
<
/
div
>
<
/
div
>
<
/
div
>
<
/
div
>
<
/
>
)
}
src/StatblockGenerator/FormSections/FeatureForm.js
View file @
ea1f3806
import
React
,
{
useContext
}
from
"
react
"
import
{
StatblockContext
}
from
"
context
"
import
{
FeatureBlock
}
from
"
../_components/FeatureBlock
"
import
NavButton
from
"
_globalC
omponents
/NavButton
"
import
{
NavButton
}
from
"
c
omponents
"
export
const
FeatureForm
=
()
=>
{
const
{
updateFeature
,
deleteFeature
,
addFeature
,
stats
}
=
...
...
@@ -18,7 +18,7 @@ export const FeatureForm = () => {
/
>
)
})}
<
NavButton
color
=
"
red
mt-2
"
onClick
=
{
addFeature
}
>
<
NavButton
color
=
"
red
"
onClick
=
{
addFeature
}
>
<
i
className
=
"
fa fa-plus mr-2
"
/>
Feature
<
/NavButton
>
...
...
src/StatblockGenerator/FormSections/LegendaryActionsForm.js
View file @
ea1f3806
import
React
,
{
useContext
}
from
"
react
"
import
{
Input
,
NavButton
}
from
"
_globalC
omponents
"
import
{
SBG_
Input
,
NavButton
}
from
"
c
omponents
"
import
{
StatblockContext
}
from
"
context
"
import
{
FeatureBlock
}
from
"
StatblockGenerator/_components/FeatureBlock
"
...
...
@@ -16,11 +16,12 @@ export const LegendaryActionsForm = () => {
>
Legendary
Actions
Per
Round
:
<
/label
>
<
Input
<
SBG_
Input
hideLabel
type
=
"
number
"
className
=
"
inline-block w-2/12
"
id
=
"
legendaryActPerRound
"
fieldName
=
"
legendaryActPerRound
"
onChange
=
{
updateState
}
value
=
{
stats
.
legendaryActPerRound
}
name
=
"
legendaryActPerRound
"
...
...
src/StatblockGenerator/StatBlockDisplay.js
View file @
ea1f3806
import
React
from
"
react
"
import
{
Property
,
PropertyBlock
}
from
"
_globalC
omponents
"
import
{
Property
}
from
"
c
omponents
"
class
StatBlockDisplay
extends
React
.
Component
{
renderAbilities
()
{
...
...
@@ -27,10 +27,11 @@ class StatBlockDisplay extends React.Component {
return
features
.
map
((
feature
)
=>
{
return
(
<
Property
Block
<
Property
key
=
{
feature
.
title
}
title
=
{
feature
.
title
}
content
=
{
feature
.
content
}
block
/>
)
})
...
...
@@ -96,7 +97,8 @@ class StatBlockDisplay extends React.Component {
if
(
!
action
.
attack
)
{
return
(
<
PropertyBlock
<
Property
block
key
=
{
i
}
title
=
{
action
.
title
}
content
=
{
action
.
content
}
...
...
src/StatblockGenerator/StatBlockForm.js
View file @
ea1f3806
import
React
from
"
react
"
import
"
react-bootstrap-typeahead/css/Typeahead.css
"
import
{
Typeahead
}
from
"
react-bootstrap-typeahead
"
import
{
Accordion
}
from
"
_globalC
omponents
"
import
{
Accordion
}
from
"
c
omponents
"
import
{
Actions
}
from
"
./_components/index
"
import
{
FeatureForm
}
from
"
./FormSections/FeatureForm
"
import
{
LegendaryActionsForm
}
from
"
./FormSections/LegendaryActionsForm
"
...
...
src/StatblockGenerator/_components/Actions.js
View file @
ea1f3806
import
React
,
{
useContext
}
from
"
react
"
import
NavButton
from
"
_globalC
omponents
/NavButton
"
import
{
NavButton
}
from
"
c
omponents
"
import
{
StatblockContext
}
from
"
context
"
import
AttackForm
from
"
./AttackForm
"
...
...
src/StatblockGenerator/_components/AttackForm.js
View file @
ea1f3806
import
React
from
"
react
"
import
{
Input
,
Select
Field
}
from
"
_globalC
omponents
"
import
{
SBG_
Input
,
SBG_
Select
}
from
"
c
omponents
"
const
AttackForm
=
(
props
)
=>
{
return
(
...
...
@@ -9,21 +9,22 @@ const AttackForm = (props) => {
}
>
<
div
className
=
"
col-span-2
"
>
<
Input
<
SBG_
Input
type
=
"
text
"
label
=
{
"
Title
"
}
placeholder
=
{
""
}
value
=
{
props
.
action
.
title
}
fieldName
=
{
"
title
-
"
+
props
.
action
.
id
}
fieldName
=
{
"
title
"
}
onChange
=
{(
e
)
=>
props
.
updateAction
(
e
,
props
.
action
.
id
,
props
.
legendary
)
}
/
>
<
/div
>
<
div
className
=
"
col-span-2
"
>
<
Select
Field
<
SBG_
Select
label
=
{
"
Attack
"
}
fieldName
=
{
"
attack-type-
"
+
props
.
action
.
id
}
id
=
{
"
attack-type
"
}
fieldName
=
{
"
type
"
}
options
=
{[
"
Melee
"
,
"
Ranged
"
]}
value
=
{
props
.
action
.
attack
.
type
}
onChange
=
{(
e
)
=>
...
...
@@ -32,9 +33,9 @@ const AttackForm = (props) => {
/
>
<
/div
>
<
div
className
=
"
col-span-1
"
>
<
Input
<
SBG_
Input
label
=
{
"
Targets
"
}
fieldName
=
{
"
targets
-
"
+
props
.
action
.
id
}
fieldName
=
{
"
targets
"
}
type
=
"
number
"
value
=
{
props
.
action
.
attack
.
targets
}
onChange
=
{(
e
)
=>
...
...
@@ -43,9 +44,9 @@ const AttackForm = (props) => {
/
>
<
/div
>
<
div
className
=
"
col-span-1
"
>
<
Input
<
SBG_
Input
label
=
{
props
.
action
.
attack
.
type
===
"
Ranged
"
?
"
Range
"
:
"
Reach
"
}
fieldName
=
{
"
reach
-
"
+
props
.
action
.
id
}
fieldName
=
{
"
reach
"
}
type
=
"
number
"
value
=
{
props
.
action
.
attack
.
reach
}
onChange
=
{(
e
)
=>
...
...
@@ -55,10 +56,10 @@ const AttackForm = (props) => {
<
/div
>
<
div
className
=
"
col-span-1
"
>
<
Input
<
SBG_
Input
label
=
{
"
#
"
}
type
=
"
number
"
fieldName
=
{
"
dieNum
-
"
+
props
.
action
.
id
}
fieldName
=
{
"
dieNum
"
}
value
=
{
props
.
action
.
attack
.
dieNum
}
onChange
=
{(
e
)
=>
props
.
updateAction
(
e
,
props
.
action
.
id
,
props
.
legendary
)
...
...
@@ -66,9 +67,9 @@ const AttackForm = (props) => {
/
>
<
/div
>
<
div
className
=
"
col-span-1
"
>
<
Select
Field
<
SBG_
Select
label
=
{
"
Dmg Die
"
}
fieldName
=
{
"
dmgDie
-
"
+
props
.
action
.
id
}
fieldName
=
{
"
dmgDie
"
}
options
=
{[
4
,
6
,
8
,
10
,
12
]}
value
=
{
props
.
action
.
attack
.
dmgDie
}
onChange
=
{(
e
)
=>
...
...
@@ -77,9 +78,9 @@ const AttackForm = (props) => {
/
>
<
/div
>
<
div
className
=
"
col-span-2
"
>
<
Select
Field
<
SBG_
Select
label
=
{
"
Dmg Type
"
}
fieldName
=
{
"
dmgType
-
"
+
props
.
action
.
id
}
fieldName
=
{
"
dmgType
"
}
options
=
{
global
.
damageTypes
}
value
=
{
props
.
action
.
attack
.
dmgType
}
onChange
=
{(
e
)
=>
...
...
src/StatblockGenerator/_components/FeatureBlock.js
View file @
ea1f3806
import
React
from
"
react
"
import
{
Input
,
Textarea
}
from
"
_globalC
omponents
"
import
{
SBG_
Input
,
Textarea
}
from
"
c
omponents
"
import
"
./FeatureBlock.scss
"
export
const
FeatureBlock
=
({
...
...
@@ -11,11 +11,11 @@ export const FeatureBlock = ({
return
(
<
div
className
=
"
feature-block relative grid grid-rows-1 grid-cols-12 gap-2 mx-1 mb-2
"
>
<
div
className
=
"
col-span-4
"
>
<
Input
<
SBG_
Input
type
=
"
text
"
label
=
{
typeText
}
value
=
{
feature
.
title
}
fieldName
=
{
"
title
-
"
+
feature
.
id
}
fieldName
=
{
"
title
"
}
onChange
=
{(
e
)
=>
updateFunc
(
e
,
feature
.
id
)}
/
>
<
/div
>
...
...
@@ -24,7 +24,7 @@ export const FeatureBlock = ({
type
=
"
text
"
label
=
{
"
Description
"
}
value
=
{
feature
.
content
}
fieldName
=
{
"
description-
"
+
feature
.
id
}
fieldName
=
{
"
content
"
}
rows
=
{
2
}
onChange
=
{(
e
)
=>
updateFunc
(
e
,
feature
.
id
)}
/
>
...
...
src/StatblockGenerator/_components/GeneratorNav.js
View file @
ea1f3806
import
React
from
"
react
"
import
{
toast
}
from
"
react-toastify
"
import
{
Modal
,
NavButton
,
OpenOrDeleteItem
}
from
"
_globalC
omponents
"
import
{
Modal
,
NavButton
,
OpenOrDeleteItem
}
from
"
c
omponents
"
import
{
UserContext
}
from
"
context
"
import
{
firebase
}
from
"
services/Firebase
"
...
...
src/_globalComponents/Column.js
deleted
100644 → 0
View file @
f7c15dea
import
React
from
"
react
"
const
Column
=
(
props
)
=>
{
return
(
<
div
className
=
{
`flex-1
${
props
.
className
}
`
}
>
{
props
.
children
}
<
/div
>
)
}
export
default
Column
src/_globalComponents/Property.js
deleted
100644 → 0
View file @
f7c15dea
import
React
from
"
react
"
const
Property
=
(
props
)
=>
{
return
(
<
div
className
=
"
statblock__property
"
>
<
span
className
=
"
statblock__property-name
"
>
{
props
.
title
}
<
/span>{" "
}
{
props
.
content
}
<
/div
>
)
}
export
default
Property
src/_globalComponents/PropertyBlock.js
deleted
100644 → 0
View file @
f7c15dea
import
React
from
"
react
"
const
PropertyBlock
=
(
props
)
=>
{
return
(
<
div
className
=
"
statblock__property statblock__property--block
"
>
<
span
className
=
"
statblock__property-name italic
"
>
{
props
.
title
}.
<
/span>{" "
}
{
props
.
content
}
<
/div
>
)
}
export
default
PropertyBlock
src/_globalComponents/Row.js
deleted
100644 → 0
View file @
f7c15dea
import
React
from
"
react
"
const
Row
=
(
props
)
=>
{
return
<
div
className
=
{
`flex
${
props
.
className
}
`
}
>
{
props
.
children
}
<
/div
>
}
export
default
Row
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment