import { IMPOSSIBLE, VersionInfo } from '@start9labs/start-sdk'

/**
 * v1.1.0:7 — Exercise-history popup auto-loads more rows on scroll.
 *
 * The popup HAD an IntersectionObserver-based infinite-scroll
 * implementation (added in v1.0.0:6 alongside the workout-history
 * page version of the same feature), but the observer was fiddly
 * inside an `absolute`-positioned scroll container. With the small
 * 60px rootMargin it would sometimes not fire at all.
 *
 * Replaced with a plain `scroll` event listener on the popup. Fires
 * when the user scrolls within 300px of the bottom (mirroring the
 * lookahead used by WorkoutsList on the main Workouts page). Also
 * runs once on mount so if the first page doesn't fill the popup,
 * we still fetch the next page proactively.
 *
 * Cosmetic: bottom-of-list status row now shows "Loading more..." /
 * "Scroll to load more" / "End of history" so the user has feedback
 * on the state instead of just seeing a thin spinner intermittently.
 *
 * No schema, no API, no data.
 */
export const v_1_1_0_7 = VersionInfo.of({
  version: '1.1.0:7',
  releaseNotes: {
    en_US:
      'Exercise-history popup (clock icon while logging or editing a workout) now reliably auto-loads more rows as you scroll, matching the Workouts page. Switched from a fiddly IntersectionObserver (which sometimes didn\'t fire inside the absolute-positioned popup) to a plain scroll listener with a 300px lookahead. Bottom-of-list now shows "Loading more..." / "Scroll to load more" / "End of history" feedback. Pure UI fix.',
  },
  migrations: {
    up: async () => {},
    down: IMPOSSIBLE,
  },
})
