import './ExploreView.scss'; import { IBounds, IExploreView, emptyBounds } from './utils'; import { IRecommendation } from '../components'; import * as React from 'react'; import { NewLightboxView } from '../NewLightboxView'; import { StrCast } from '../../../../fields/Types'; export const ExploreView = (props: IExploreView) => { const { recs, bounds = emptyBounds } = props; return (
{recs && recs.map(rec => { const x_bound: number = Math.max(Math.abs(bounds.max_x), Math.abs(bounds.min_x)); const y_bound: number = Math.max(Math.abs(bounds.max_y), Math.abs(bounds.min_y)); if (rec.embedding) { const x = (rec.embedding.x / x_bound) * 50; const y = (rec.embedding.y / y_bound) * 50; return (
{}} style={{ top: `calc(50% + ${y}%)`, left: `calc(50% + ${x}%)` }}> {rec.title}
); } else return null; })}
{StrCast(NewLightboxView.LightboxDoc?.title)}
); };