Skip to content

Commit

Permalink
Update ResearchDetail.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
dccommon committed Apr 1, 2024
1 parent 3369f3c commit 3052581
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/components/page/researchDetail/ResearchDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ export const ResearchDetail: FC<PaperModel> = ({
return `${publication.firstPage}-${publication.lastPage}`;
}, [publication.firstPage, publication.lastPage]);

const quotation = useMemo(() => {
const authorsString = authors.map((author) => `${author.familyName.ja}${author.givenName.ja}`).join(", ");
const year = new Date(publishDateStr).getFullYear();

const parts = [
`${authorsString}.`,
title,
journalTitle ? `${journalTitle},` : null,
publication.volume ? `Vol.${publication.volume},` : null,
publication.issue ? `No.${publication.issue},` : null,
pages ? `pp.${pages},` : null,
`${year}.`,
].filter(Boolean);

return parts.join(" ");
}, [authors, title, journalTitle, publication.volume, publication.issue, pages, publishDateStr]);

return (
<div>
{hero && <ResearchHero hero={hero} />}
Expand Down Expand Up @@ -117,7 +134,7 @@ export const ResearchDetail: FC<PaperModel> = ({
ref={citeTextareaRef}
className={"h-full w-full resize-none border-0 bg-transparent"}
readOnly
value={`${authors.map((author) => `${author.familyName.ja}${author.givenName.ja}`).join(", ")}. ${title}, ${journalTitle}, Vol.${publication.volume}, No.${publication.issue}, pp.${pages}, ${new Date(publishDateStr).getFullYear()}.`}
value={quotation}
/>
</div>
<div
Expand Down

0 comments on commit 3052581

Please sign in to comment.