UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) 849 B
import{jsx as u}from"react/jsx-runtime";import{observer as i}from"mobx-react-lite";import{useEffect as l,useState as m}from"react";import f from"../ui/EventBadge";import{shouldShowEventFullBadge as c}from"../utils/eventFullBadge";import{calculateTimeUntilStart as g,getEventStatus as p,getEventStatusLabel as E}from"../utils/eventTime";import{t as v}from"../utils/i18n";function L(e){const[n,r]=m(()=>Date.now()),s=g(e.startDate,n),t=p(e,n,s),a=t!=="past"&&t!=="none";return l(()=>{if(!a)return;const o=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(o)},[a]),{status:t,statusLabel:E(t,s),isUrgent:t==="starting-soon"&&s.isLessThan10Minutes}}const d=i(({event:e,...n})=>{const{status:r,statusLabel:s,isUrgent:t}=L(e);return u(f,{status:r,statusLabel:s,showFullBadge:c(e),fullLabel:v("EVENT IS FULL"),isUrgent:t,...n})});export default d;