// Shared helper: renders an admin-uploaded photo if present in localStorage,
// otherwise falls back to the striped placeholder. Used by non-social sections.
function PhImage({ id, className, label }) {
  const [src, setSrc] = React.useState(null);
  React.useEffect(() => {
    try {
      const v = localStorage.getItem('flowfam_img_' + id);
      if (v) setSrc(v);
    } catch (e) {}
  }, [id]);
  if (src) {
    return <div className={className} style={{ backgroundImage: `url(${src})`, backgroundSize: 'cover', backgroundPosition: 'center' }} />;
  }
  return <div className={'ph ' + className} data-label={label} />;
}

window.PhImage = PhImage;
