import React from "react"
import {amisRender, commonInfo, crudCommonOptions, paginationTemplate, stockListColumns} from '../../util/amis.tsx'
import {useNavigate, useParams} from 'react-router'

function StockCollectionDetail() {
  const navigate = useNavigate()
  const {id} = useParams()
  return (
    <div className="stock-collection-detail">
      {amisRender(
        {
          type: 'page',
          title: '股票集详情',
          initApi: `get:${commonInfo.baseUrl}/stock_collection/detail/${id}`,
          body: [
            {
              type: 'crud',
              source: '${stocks}',
              ...crudCommonOptions(),
              ...paginationTemplate(15, undefined, ['filter-toggler']),
              columns: stockListColumns(navigate),
            }
          ]
        }
      )}
    </div>
  )
}

export default React.memo(StockCollectionDetail)