Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

coop.tsx 825B

1234567891011121314151617181920212223242526272829
  1. import Cursor from './cursor'
  2. import { useCoopSelector } from 'state/coop/coop-state'
  3. import { useSelector } from 'state'
  4. export default function Presence(): JSX.Element {
  5. const others = useCoopSelector((s) => s.data.others)
  6. const currentPageId = useSelector((s) => s.data.currentPageId)
  7. if (!others) return null
  8. return (
  9. <>
  10. {Object.values(others)
  11. .filter(({ presence }) => presence?.pageId === currentPageId)
  12. .map(({ connectionId, presence }) => {
  13. return (
  14. <Cursor
  15. key={`cursor-${connectionId}`}
  16. color={'red'}
  17. duration={presence.duration}
  18. times={presence.times}
  19. bufferedXs={presence.bufferedXs}
  20. bufferedYs={presence.bufferedYs}
  21. />
  22. )
  23. })}
  24. </>
  25. )
  26. }