import React from 'react'
import GrentReducer from './grent'
import Upload from '../../components/Upload'
import styles from './index.module.css'


export default function ModelList({ className }: any) {
  const { referData, Element, models } = GrentReducer({
    delUrl: '/fdModel/delete/',
    getUrl: '/fdModel/list/',
    zipUrl: '/fdModel/unzip/',
    sectionUrl: '/fdModel/command/osgb/',
    transferUrl: '/fdModel/move/'
  })

  for (let i = 0; i < models.length; i++) {
    let model = models[i] as Model
    if (model.status !== 6) continue
    setTimeout(() => referData(), 1000)
    break;
  }

  return (
    <div className={className}>
      <div className={styles.uplayer} >
        <Upload api='/fdModel/upload' check='/fdModel/check/' upHandle={referData} className={styles.inputitem} />
      </div>
      {Element}
    </div>
  )
}