-
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.
fix(improvements): full rework of message preview, add sideMenu
- Loading branch information
Showing
11 changed files
with
414 additions
and
355 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 was deleted.
Oops, something went wrong.
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,85 @@ | ||
import React from "react"; | ||
import { | ||
Badge, | ||
Col, | ||
Container, | ||
Row, | ||
Text, | ||
Notice, | ||
Title, | ||
} from "@dataesr/dsfr-plus"; | ||
import ContributorInfo from "./contributor-info"; | ||
import StaffActions from "./staff-action"; | ||
import { Contribution } from "../../types"; | ||
import { BadgeColor } from "./utils"; | ||
import "./styles.scss"; | ||
|
||
interface ContributionItemProps { | ||
data: Contribution; | ||
highlightedQuery: string; | ||
refetch: () => void; | ||
} | ||
const ContributionItem: React.FC<ContributionItemProps> = ({ | ||
data, | ||
highlightedQuery, | ||
refetch, | ||
}) => { | ||
return ( | ||
<Container fluid> | ||
<div> | ||
{data?.tags?.length > 0 && ( | ||
<Badge size="sm" color="purple-glycine" className="fr-mr-1w fr-mb-1w"> | ||
{data.tags.join(", ")} | ||
</Badge> | ||
)} | ||
<Badge size="sm" color="purple-glycine" className="fr-mr-1w fr-mb-1w"> | ||
{data?.status} | ||
</Badge> | ||
{data?.responseFrom && ( | ||
<Badge size="sm" color="blue-ecume" className="fr-mr-1w fr-mb-1w"> | ||
{`Réponse envoyée par ${data.responseFrom}`} | ||
</Badge> | ||
)} | ||
{data?.comment && data?.team?.length > 0 && ( | ||
<Badge size="sm" color="green-emeraude" className="fr-mr-1w fr-mb-1w"> | ||
{`Commenté par ${data.team[0]}`} | ||
</Badge> | ||
)} | ||
{data?.type && ( | ||
<Badge | ||
size="sm" | ||
color={BadgeColor({ type: data.type })} | ||
className="fr-mr-1w fr-mb-1w" | ||
> | ||
{data.type} | ||
</Badge> | ||
)} | ||
</div> | ||
<Row> | ||
<Col md="12"> | ||
<Title look="h5">{data?.name}</Title> | ||
{!data?.comment && ( | ||
<Notice type="info" closeMode="disallow" className="fr-mb-2w"> | ||
Aucune réponse apportée à ce message pour l'instant | ||
</Notice> | ||
)} | ||
</Col> | ||
<Text size="sm" bold> | ||
<i>Reçu le {new Date(data?.created_at).toLocaleDateString()}</i> | ||
</Text> | ||
</Row> | ||
<Row> | ||
<Col> | ||
<ContributorInfo | ||
data={data} | ||
highlightedQuery={highlightedQuery} | ||
refetch={refetch} | ||
/> | ||
<StaffActions refetch={refetch} data={data} /> | ||
</Col> | ||
</Row> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default ContributionItem; |
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,58 @@ | ||
import React from "react"; | ||
import { Badge, SideMenu, SideMenuItem, Text } from "@dataesr/dsfr-plus"; | ||
import { Contribution } from "../../types"; | ||
|
||
interface ContributorSummaryProps { | ||
contributions: Contribution[]; | ||
onSelectContribution: (id: string) => void; | ||
} | ||
|
||
const ContributorSummary: React.FC<ContributorSummaryProps> = ({ | ||
contributions, | ||
onSelectContribution, | ||
}) => { | ||
const handleClick = (id: string) => { | ||
onSelectContribution(id); | ||
window.scrollTo({ top: 200, behavior: "smooth" }); | ||
}; | ||
|
||
return ( | ||
<SideMenu title="Contributeurs" sticky fullHeight> | ||
{contributions.map((contribution) => ( | ||
<SideMenuItem | ||
key={contribution.id} | ||
title={ | ||
<div> | ||
{contribution?.status && ( | ||
<Badge | ||
size="sm" | ||
color="purple-glycine" | ||
className="fr-mr-1w fr-mb-1w" | ||
> | ||
{contribution.status} | ||
</Badge> | ||
)} | ||
{contribution?.tags?.length > 0 && ( | ||
<Badge | ||
size="sm" | ||
color="purple-glycine" | ||
className="fr-mr-1w fr-mb-1w" | ||
> | ||
{contribution.tags.join(", ")} | ||
</Badge> | ||
)} | ||
<Text size="sm">{contribution.name}</Text> | ||
<Text size="sm" className="fr-text--italic"> | ||
{new Date(contribution.created_at).toLocaleDateString()} | ||
</Text> | ||
</div> | ||
} | ||
defaultExpanded={false} | ||
onClick={() => handleClick(contribution._id)} | ||
/> | ||
))} | ||
</SideMenu> | ||
); | ||
}; | ||
|
||
export default ContributorSummary; |
Oops, something went wrong.