-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from aodn/feature/add-citation-contact#5704
Feature/add citation contact#5704
- Loading branch information
Showing
4 changed files
with
63 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 51 additions & 2 deletions
53
src/pages/detail-page/subpages/tab-panels/CitationPanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,56 @@ | ||
import React from "react"; | ||
import React, { useEffect, useMemo, useState } from "react"; | ||
import { useDetailPageContext } from "../../context/detail-page-context"; | ||
import ContactBlock from "../components/ContactBlock"; | ||
import NavigatablePanel from "../components/NavigatablePanel"; | ||
|
||
const CitationPanel = () => { | ||
return <div>CitationCard</div>; | ||
const context = useDetailPageContext(); | ||
const citationContacts = useMemo( | ||
() => | ||
context.collection | ||
?.getContacts() | ||
?.filter((contact) => contact.roles.includes("citation")), | ||
[context.collection] | ||
); | ||
|
||
const [isLoading, setIsLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
if (!context.collection) { | ||
setIsLoading(true); | ||
} else { | ||
setIsLoading(false); | ||
} | ||
}, [context.collection]); | ||
|
||
const blocks = useMemo( | ||
() => [ | ||
{ | ||
title: "Cited Responsible Parties", | ||
component: ( | ||
<ContactBlock | ||
title="Cited Responsible Parties" | ||
contacts={citationContacts ? citationContacts : []} | ||
/> | ||
), | ||
}, | ||
{ | ||
title: "License", | ||
component: <div>License</div>, | ||
}, | ||
{ | ||
title: "Suggested Citation", | ||
component: <div>Suggested Citation</div>, | ||
}, | ||
{ | ||
title: "Constraints", | ||
component: <div>Constraints</div>, | ||
}, | ||
], | ||
[citationContacts] | ||
); | ||
|
||
return <NavigatablePanel childrenList={blocks} isLoading={isLoading} />; | ||
}; | ||
|
||
export default CitationPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters