You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

status-bar.tsx 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { useStateDesigner } from '@state-designer/react'
  2. import state from 'state'
  3. import { useCoopSelector } from 'state/coop/coop-state'
  4. import styled from 'styles'
  5. const size: any = { '@sm': 'small' }
  6. export default function StatusBar(): JSX.Element {
  7. const local = useStateDesigner(state)
  8. const status = useCoopSelector((s) => s.data.status)
  9. const others = useCoopSelector((s) => s.data.others)
  10. const active = local.active.slice(1).map((s) => {
  11. const states = s.split('.')
  12. return states[states.length - 1]
  13. })
  14. const log = local.log[0]
  15. return (
  16. <StatusBarContainer size={size}>
  17. <Section>
  18. {active.join(' | ')} | {log} | {status} (
  19. {Object.values(others).length || 0})
  20. </Section>
  21. </StatusBarContainer>
  22. )
  23. }
  24. const StatusBarContainer = styled('div', {
  25. position: 'absolute',
  26. bottom: 0,
  27. left: 0,
  28. width: '100%',
  29. zIndex: 300,
  30. height: 40,
  31. userSelect: 'none',
  32. borderTop: '1px solid black',
  33. gridArea: 'status',
  34. display: 'grid',
  35. gridTemplateColumns: 'auto 1fr auto',
  36. alignItems: 'center',
  37. backgroundColor: 'white',
  38. gap: 8,
  39. fontSize: '$0',
  40. padding: '0 16px',
  41. variants: {
  42. size: {
  43. small: {
  44. fontSize: '$1',
  45. },
  46. },
  47. },
  48. })
  49. const Section = styled('div', {
  50. whiteSpace: 'nowrap',
  51. overflow: 'hidden',
  52. })