1
0
Fork 0

feat(core): Added new debug event type and debug system

This commit is contained in:
Joost De Cock 2020-07-18 16:48:29 +02:00
parent b360359cf6
commit 03da84b824
52 changed files with 860 additions and 398 deletions

View file

@ -0,0 +1,20 @@
import React from 'react'
import DebugIcon from '@material-ui/icons/PlayCircleOutline'
import InfoIcon from '@material-ui/icons/Info'
import WarningIcon from '@material-ui/icons/ErrorOutline'
import ErrorIcon from '@material-ui/icons/HighlightOff'
import Markdown from 'react-markdown'
const Event = ({ type, event }) => (
<div className={`draft-event ${type}`}>
<div className={`icon ${type}`}>
{type === 'debug' && <DebugIcon fontSize="small" />}
{type === 'info' && <InfoIcon fontSize="small" />}
{type === 'warning' && <WarningIcon fontSize="small" />}
{type === 'error' && <ErrorIcon fontSize="small" />}
</div>
<Markdown source={event} />
</div>
)
export default Event

View file

@ -0,0 +1,16 @@
import React from 'react'
import Event from './event'
const DraftEvents = ({ events, app }) => (
<div className="draft-events">
{['error', 'warning', 'info', 'debug'].map((type) => (
<div className={`events-${type}`}>
{events[type].map((event, index) => (
<Event event={event} app={app} type={type} key={index} />
))}
</div>
))}
</div>
)
export default DraftEvents

View file

@ -16,6 +16,7 @@ import PaperlessIcon from '@material-ui/icons/Nature'
import CompleteIcon from '@material-ui/icons/Style'
import UnhideIcon from '@material-ui/icons/ChevronLeft'
import HideIcon from '@material-ui/icons/ChevronRight'
import Events from './Events'
const DraftPattern = (props) => {
const [design, setDesign] = useState(true)
@ -123,6 +124,7 @@ const DraftPattern = (props) => {
viewBox={viewBox}
className="freesewing draft shadow"
/>
<Events events={patternProps.events} />
{hideAside && (
<div style={styles.unhide}>
<IconButton