/* global React */
// sku-cells.jsx — ImgMarkerCell (CellDisplay / CellEditor moved to primitives.jsx)

// ─── ImgMarkerCell ──────────────────────────────────────────────────────────

const ImgMarkerCell = ({ row, single }) => {
  if (single) {
    // synthetic pre-submit marker: count uploaded images
    const IMG_KEYS_LOCAL = ["imgMain", "imgActivity", "imgNutrition", "imgScene1", "imgScene2", "imgScene3", "imgScene4"];
    const uploaded = IMG_KEYS_LOCAL.filter(k => row[k]).length;
    return (
      <span className={`img-marker${uploaded === IMG_KEYS_LOCAL.length ? " img-marker--done" : uploaded > 0 ? " img-marker--partial" : ""}`}>
        {uploaded}/{IMG_KEYS_LOCAL.length}
      </span>
    );
  }
  // individual image col post-submit
  const hasImg = row[single];
  return (
    <span className={`img-marker${hasImg ? " img-marker--done" : ""}`}>
      {hasImg ? "已上傳" : "未上傳"}
    </span>
  );
};

Object.assign(window, { ImgMarkerCell });
