All files / web/src/app/vision-training/loader-test-check page.tsx

0% Statements 0/70
0% Branches 0/1
0% Functions 0/1
0% Lines 0/70

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71                                                                                                                                             
'use client'

import { useState } from 'react'
import { css } from '../../../../styled-system/css'
import { checkWindowCv } from '@/lib/vision/opencv/checkCv'

/**
 * Test checking window.cv from separate file - no loading.
 */
export default function LoaderTestCheckPage() {
  const [result, setResult] = useState<{
    exists: boolean
    hasImread: boolean
  } | null>(null)

  const handleTest = () => {
    console.log('[LoaderTestCheck] Button clicked')
    const res = checkWindowCv()
    console.log('[LoaderTestCheck] checkWindowCv returned:', res)
    setResult(res)
  }

  return (
    <div
      data-component="loader-test-check-page"
      className={css({
        minHeight: '100vh',
        bg: 'gray.900',
        color: 'gray.100',
        p: 8,
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'center',
        justifyContent: 'center',
        gap: 4,
      })}
    >
      <h1 className={css({ fontSize: '2xl', fontWeight: 'bold' })}>Check window.cv (No Loading)</h1>
      <p className={css({ color: 'gray.400', mb: 4 })}>
        Just checks if window.cv exists - no loading.
      </p>

      <button
        type="button"
        onClick={handleTest}
        className={css({
          px: 6,
          py: 3,
          bg: 'rose.600',
          color: 'white',
          borderRadius: 'lg',
          fontSize: 'lg',
          fontWeight: 'bold',
          border: 'none',
          cursor: 'pointer',
          _hover: { bg: 'rose.500' },
        })}
      >
        Check window.cv
      </button>

      {result && (
        <div className={css({ mt: 4, textAlign: 'center' })}>
          <div>cv exists: {result.exists ? 'yes' : 'no'}</div>
          <div>cv.imread exists: {result.hasImread ? 'yes' : 'no'}</div>
        </div>
      )}
    </div>
  )
}