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

const IssuesView = () => (
  <EntityRecordViewPage
    singularLabel="Issue"
    pluralLabel="Issues"
    stateKey="issues"
    recordKey="issues"
    fetchRecord={fetch}
    listHref="/issues/issues-list"
    editHref={(id) => `/issues/issues-edit/?id=${id ?? ''}`}
  />
);

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

export default IssuesView;
