import React from 'react'; import { Header, Segment, Icon, Grid, List } from 'semantic-ui-react'; import ExperimentalWrapper from './ExperimentalWrapper.jsx'; import TeamGlobeViewer from './TeamGlobeViewer.jsx'; import TEAM_LOCATIONS from './TeamGlobeData.js'; import { formatInTimeZone } from 'date-fns-tz'; export default class TeamGlobe extends React.Component { constructor(props) { super(props); this.state = { currentTime: new Date(), }; this._interval = null; } componentDidMount() { this._interval = setInterval(() => { this.setState({ currentTime: new Date() }); }, 1000); } componentWillUnmount() { if (this._interval) clearInterval(this._interval); } render() { const { currentTime } = this.state; // Group locations by timezone for the sidebar const tzGroups = {}; TEAM_LOCATIONS.forEach((loc) => { if (!tzGroups[loc.timezone]) { tzGroups[loc.timezone] = []; } tzGroups[loc.timezone].push(loc); }); return (
Team Globe Interactive 3D view of where Bigscreen staff are located worldwide, with live local times.
Local Times
{TEAM_LOCATIONS.map((loc, i) => { const time = formatInTimeZone(currentTime, loc.timezone, 'h:mm:ss a'); const tz = formatInTimeZone(currentTime, loc.timezone, 'zzz'); const hour = parseInt(formatInTimeZone(currentTime, loc.timezone, 'H'), 10); const isWorkHours = hour >= 9 && hour < 18; return ( {loc.name} {loc.staff} staff {time} {tz} {isWorkHours ? '🟢 Working hours' : '🔴 Off hours'} ); })}
); } }