import React, { ReactElement } from 'react';
import LayoutAuthenticated from '../../layouts/Authenticated';
import { fetch } from '../../stores/grant_evaluations/grant_evaluationsSlice';
import EntityRecordViewPage from '../../components/EntityPage/EntityRecordViewPage';

const GrantEvaluationsView = () => (
  <EntityRecordViewPage
    singularLabel="Grant Evaluation"
    pluralLabel="Grant Evaluations"
    stateKey="grant_evaluations"
    recordKey="grant_evaluations"
    fetchRecord={fetch}
    listHref="/grant_evaluations/grant_evaluations-list"
    editHref={(id) => `/grant_evaluations/grant_evaluations-edit/?id=${id ?? ''}`}
  />
);

GrantEvaluationsView.getLayout = function getLayout(page: ReactElement) {
  return <LayoutAuthenticated permission={'READ_GRANT_EVALUATIONS'}>{page}</LayoutAuthenticated>;
};

export default GrantEvaluationsView;
