2021-05-30 13:14:35 +00:00
|
|
|
import { useStateDesigner } from '@state-designer/react'
|
|
|
|
import state from 'state'
|
|
|
|
import styled from 'styles'
|
2021-05-09 13:04:42 +00:00
|
|
|
|
2021-06-28 20:45:06 +00:00
|
|
|
const size: any = { '@sm': 'small' }
|
|
|
|
|
2021-06-21 21:35:28 +00:00
|
|
|
export default function StatusBar(): JSX.Element {
|
2021-05-09 13:04:42 +00:00
|
|
|
const local = useStateDesigner(state)
|
2021-07-11 13:07:22 +00:00
|
|
|
|
|
|
|
const shapesInView = state.values.shapesToRender.length
|
2021-05-09 13:04:42 +00:00
|
|
|
|
2021-07-13 19:34:43 +00:00
|
|
|
const active = local.active
|
|
|
|
.slice(1)
|
|
|
|
.map((s) => {
|
|
|
|
const states = s.split('.')
|
|
|
|
return states[states.length - 1]
|
|
|
|
})
|
|
|
|
.join(' | ')
|
2021-06-28 20:45:06 +00:00
|
|
|
|
2021-05-09 13:04:42 +00:00
|
|
|
const log = local.log[0]
|
|
|
|
|
2021-07-11 13:07:22 +00:00
|
|
|
if (process.env.NODE_ENV !== 'development') return null
|
2021-07-11 12:51:01 +00:00
|
|
|
|
2021-05-09 13:04:42 +00:00
|
|
|
return (
|
2021-06-28 20:45:06 +00:00
|
|
|
<StatusBarContainer size={size}>
|
2021-06-11 22:10:17 +00:00
|
|
|
<Section>
|
2021-07-13 19:34:43 +00:00
|
|
|
{active} - {log}
|
2021-06-11 22:10:17 +00:00
|
|
|
</Section>
|
2021-07-11 13:07:22 +00:00
|
|
|
<Section>{shapesInView || '0'} Shapes</Section>
|
2021-05-09 13:04:42 +00:00
|
|
|
</StatusBarContainer>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-05-30 13:14:35 +00:00
|
|
|
const StatusBarContainer = styled('div', {
|
2021-05-09 13:04:42 +00:00
|
|
|
height: 40,
|
2021-05-30 13:14:35 +00:00
|
|
|
userSelect: 'none',
|
2021-07-10 20:39:29 +00:00
|
|
|
borderTop: '1px solid $border',
|
2021-05-30 13:14:35 +00:00
|
|
|
gridArea: 'status',
|
2021-07-11 13:07:22 +00:00
|
|
|
display: 'flex',
|
2021-07-10 20:39:29 +00:00
|
|
|
color: '$text',
|
2021-07-11 13:07:22 +00:00
|
|
|
justifyContent: 'space-between',
|
2021-05-30 13:14:35 +00:00
|
|
|
alignItems: 'center',
|
2021-07-10 20:39:29 +00:00
|
|
|
backgroundColor: '$panel',
|
2021-05-09 13:04:42 +00:00
|
|
|
gap: 8,
|
2021-05-30 13:14:35 +00:00
|
|
|
fontSize: '$0',
|
|
|
|
padding: '0 16px',
|
|
|
|
|
|
|
|
variants: {
|
|
|
|
size: {
|
|
|
|
small: {
|
|
|
|
fontSize: '$1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-05-09 13:04:42 +00:00
|
|
|
})
|
|
|
|
|
2021-05-30 13:14:35 +00:00
|
|
|
const Section = styled('div', {
|
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
overflow: 'hidden',
|
2021-05-09 13:04:42 +00:00
|
|
|
})
|