sub-manager-frontend/src/routes/story.jsx

30 lines
1006 B
React
Raw Normal View History

import { useLoaderData, useParams, Link } from "react-router-dom";
2023-09-06 15:14:50 +00:00
import Table from "../Components/Table";
import PageHeader from "../Components/PageHeader";
2023-09-07 08:07:38 +00:00
import { submissionsTableOptions } from "./submissions.jsx";
import { useState, useEffect } from "react";
2023-09-07 08:07:38 +00:00
const { filterList=[...filterList],highlights,clickables } = submissionsTableOptions
2023-09-06 15:14:50 +00:00
export default function Story(){
const { storyId } = useParams()
const { stories } = useLoaderData()
2023-09-11 12:44:24 +00:00
const storyData = stories.find(row=>row.id==storyId)
2023-09-10 15:01:05 +00:00
2023-09-06 15:14:50 +00:00
return(
<>
2023-09-10 15:01:05 +00:00
<div id="page">
<PageHeader super={'Story#'+storyId} heading={storyData.title}/>
<div>Wordcount: {storyData.word_count}</div>
2023-09-07 08:07:38 +00:00
<Table
data={storyData.submissions}
2023-09-10 15:01:05 +00:00
filterList={[...filterList,'story']}
2023-09-07 08:07:38 +00:00
highlights={highlights}
clickables={clickables}
sortByDefault='date_submitted'
2023-09-10 15:01:05 +00:00
header='Submissions:'
2023-09-07 08:07:38 +00:00
></Table>
<Link to={`/story/${storyData.id}/edit`}>EDIT</Link>
2023-09-10 15:01:05 +00:00
</div>
2023-09-06 15:14:50 +00:00
</>
)
}