-
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.
feat(contribute_production): add production page
- Loading branch information
Showing
14 changed files
with
521 additions
and
33 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
65 changes: 65 additions & 0 deletions
65
src/pages/api-operation-page/contribution-production-card.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,65 @@ | ||
import { | ||
Accordion, | ||
AccordionGroup, | ||
Badge, | ||
Col, | ||
Container, | ||
Row, | ||
Text, | ||
} from "@dataesr/dsfr-plus"; | ||
import "./styles.scss"; | ||
import { Contribute_Production } from "../../types"; | ||
import ContributorProductionInfo from "./contributor-production-info"; | ||
import StaffProductionActions from "./staff-production-action"; | ||
|
||
const ContributionProductionItem = ({ | ||
data, | ||
}: { | ||
data: Contribute_Production; | ||
}) => { | ||
const renderAccordion = () => ( | ||
<Container fluid className="accordion"> | ||
<Row> | ||
<Col> | ||
<Badge | ||
size="sm" | ||
color="purple-glycine" | ||
className="fr-mr-1w fr-mb-1w status" | ||
> | ||
{data.status} | ||
</Badge> | ||
<Badge | ||
size="sm" | ||
color="green-emeraude" | ||
className="fr-mr-1w fr-mb-1w status" | ||
> | ||
{data.productions.length.toString() + " Publications à lier "} | ||
</Badge> | ||
</Col> | ||
<Text size="sm"> | ||
<i className="date"> | ||
Reçu le {new Date(data.created_at).toLocaleDateString()} | ||
</i> | ||
</Text> | ||
</Row> | ||
<Row> | ||
<Col> | ||
<Text size="sm" bold className="name"> | ||
{data.name} | ||
</Text> | ||
</Col> | ||
</Row> | ||
</Container> | ||
); | ||
|
||
return ( | ||
<AccordionGroup> | ||
<Accordion title={renderAccordion}> | ||
<ContributorProductionInfo data={data} /> | ||
<StaffProductionActions data={data} /> | ||
</Accordion> | ||
</AccordionGroup> | ||
); | ||
}; | ||
|
||
export default ContributionProductionItem; |
12 changes: 12 additions & 0 deletions
12
src/pages/api-operation-page/contributor-production-info.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,12 @@ | ||
import { Contribute_Production } from "../../types"; | ||
import MessagePreview from "./message-preview"; | ||
|
||
const ContributorProductionInfo = ({ | ||
data, | ||
}: { | ||
data: Contribute_Production; | ||
}) => { | ||
return <MessagePreview data={data} />; | ||
}; | ||
|
||
export default ContributorProductionInfo; |
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,81 @@ | ||
import { Col, Link, Text } from "@dataesr/dsfr-plus"; | ||
import React, { useState } from "react"; | ||
import { Production } from "../../types"; | ||
|
||
const ContributorRequests: React.FC<{ | ||
data: { productions: Production[] }; | ||
}> = ({ data }) => { | ||
const [copiedId, setCopiedId] = useState<string | null>(null); | ||
|
||
const copyToClipboard = (text: string) => { | ||
navigator.clipboard.writeText(text).then(() => { | ||
setCopiedId(text); | ||
}); | ||
}; | ||
|
||
return ( | ||
<> | ||
{data.productions.map((production, index) => ( | ||
<Col md="3" className="fr-mr-1v"> | ||
<Text | ||
size="sm" | ||
key={index} | ||
style={{ | ||
border: "1px solid #ccc", | ||
borderRadius: "5px", | ||
padding: "5px", | ||
}} | ||
> | ||
<Text size="sm" className="textInCard"> | ||
<strong>ID :</strong>{" "} | ||
<span onClick={() => copyToClipboard(production.id)}> | ||
{production.id} | ||
</span> | ||
{copiedId === production.id && ( | ||
<span | ||
style={{ | ||
color: "white", | ||
backgroundColor: "#efcb3a", | ||
marginLeft: "10px", | ||
padding: "2px 5px", | ||
borderRadius: "5px", | ||
fontSize: "0.8em", | ||
}} | ||
> | ||
ID copié | ||
</span> | ||
)} | ||
</Text> | ||
<Text className="textInCard" size="sm"> | ||
<Link | ||
className="fr-mr-1w" | ||
target="_blank" | ||
rel="noreferrer noopener external" | ||
href={`https://scanr.enseignementsup-recherche.gouv.fr/publication/${production.id}`} | ||
> | ||
scanR | ||
</Link> | ||
<Link | ||
className="fr-mr-1w" | ||
target="_blank" | ||
rel="noreferrer noopener external" | ||
href={`https://paysage.enseignementsup-recherche.gouv.fr/`} | ||
> | ||
Paysage | ||
</Link> | ||
<Link | ||
target="_blank" | ||
rel="noreferrer noopener external" | ||
href={`https://paysage.enseignementsup-recherche.gouv.fr/`} | ||
> | ||
dataESR | ||
</Link> | ||
</Text> | ||
</Text> | ||
</Col> | ||
))} | ||
</> | ||
); | ||
}; | ||
|
||
export default ContributorRequests; |
Oops, something went wrong.