@expofp/floorplan
Version:
Interactive floor plan library for expos and events
2 lines (1 loc) • 2.37 kB
JavaScript
import{jsx as s,jsxs as r}from"react/jsx-runtime";import"./Speaker.scss";import k from"classnames";import{observer as f}from"mobx-react-lite";import{useObserver as E}from"mobx-react-lite";import{useEffect as j,useMemo as y,useRef as h,useState as T}from"react";import x from"../data";import t,{uiState as o}from"../store";import{GaEventActions as c,sendEventToGa as m}from"../tools/gtag";import{t as u}from"../utils/i18n";import{Schedule as D,SidebarActions as A}from"./";const G=f(()=>{const i=h(null),n=h(null),[v,_]=T(!1),e=t.speakerStore.selectedSpeaker;if(!e)return s("div",{className:"efp-speaker-empty",children:u("Speaker not found")});const d=t.speakerStore.getEventsBySpeaker(e.id),p=y(()=>[...d].sort((a,l)=>{const B=new Date(a.startDate).getTime(),w=new Date(l.startDate).getTime();return B-w}),[d]);j(()=>{(()=>{if(n.current){const l=n.current.offsetHeight;_(l>300)}})()},[]);const S=a=>{t.selectEventItem(a,!0)},N=()=>{e.bookmarked=!e.bookmarked,m(c.ClickCustomButton,e.name)},C=()=>{m(c.ClickCustomButton,e.name),t.toggleModal("share")},g=()=>{m(c.ClickCustomButton,e.name)},b=k({"efp-speaker":!0,[o.responsiveClass]:!0});return E(()=>r("div",{className:b,children:[r("div",{className:"efp-speaker__header",children:[s("div",{className:"efp-speaker__icon",children:s("i",{className:"icon-speaker-solid"})}),r("div",{className:"efp-speaker__content",children:[s("div",{className:"efp-speaker__name",children:e.name}),e.company&&s("div",{className:"efp-speaker__company",children:e.company}),e.jobTitle&&s("div",{className:"efp-speaker__job-title",children:e.jobTitle})]}),e.photoFile&&s("div",{className:"efp-speaker__photo",children:s("img",{src:e.photoFile,alt:e.name})})]}),s("div",{className:"efp-speaker__buttons",children:!o.isGuidedToursActive&&s(A,{showBookmark:!o.disableBookmarked&&!x.hideBookmarks&&!o.kiosk,showDirections:!1,inBookmark:e.bookmarked||!1,showShare:!0,showVisited:!1,visited:!1,onClickBookmark:N,onClickShare:C,onClickVisited:g})}),s("div",{className:k("efp-speaker__details",{"details-hidden":o.kiosk&&v}),ref:n,children:p.length>0&&r("div",{className:"efp-speaker-events",children:[s("h3",{className:"efp-speaker-events__title",children:u("Sessions")}),s(D,{events:p,showBooths:!0,isSessions:!1,onEventClick:S})]})})]}))}),H=f(()=>{const i=t.uiState.details;return!i||i?.entity?.type!=="speaker"?null:s(G,{})});export default H;