-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into int
- Loading branch information
Showing
19 changed files
with
222 additions
and
196 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
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
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
48 changes: 48 additions & 0 deletions
48
ui/src/components/Publication/PublicationPage/HeaderActions/index.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import * as Components from '@/components'; | ||
import * as Config from '@/config'; | ||
import * as Helpers from '@/helpers'; | ||
import * as Stores from '@/stores'; | ||
import * as Types from '@/types'; | ||
|
||
type Props = { | ||
authorIds: string[]; | ||
publicationId: string; | ||
publicationType: Types.PublicationType; | ||
}; | ||
|
||
const HeaderActions: React.FC<Props> = (props) => { | ||
const { user } = Stores.useAuthStore(); | ||
|
||
if (!user) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="col-span-8 mb-10 pb-10 flex flex-col md:flex-row gap-4 md:gap-8 border-b border-grey-200"> | ||
{Helpers.linkedPublicationTypes[props.publicationType as keyof typeof Helpers.linkedPublicationTypes].map( | ||
(childPublicationType) => { | ||
return ( | ||
<Components.Button | ||
variant="block" | ||
title={`Write a linked ${Helpers.formatPublicationType(childPublicationType as Types.PublicationType)}`} | ||
key={childPublicationType} | ||
href={`${Config.urls.createPublication.path}?for=${props.publicationId}&type=${childPublicationType}`} | ||
openNew={true} | ||
/> | ||
); | ||
} | ||
)} | ||
{!props.authorIds.includes(user.id) && ( | ||
<Components.Button | ||
title="Write a review" | ||
variant="block" | ||
href={`${Config.urls.createPublication.path}?for=${props.publicationId}&type=PEER_REVIEW`} | ||
openNew={true} | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default HeaderActions; |
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
Oops, something went wrong.