-
Notifications
You must be signed in to change notification settings - Fork 355
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 #4439 from coralproject/feat/CORL-2978-rejection-r…
…easons-add-comment-card-user-drawer [CORL-2978]: Add rejection reasons to comment card and user drawer
- Loading branch information
Showing
11 changed files
with
246 additions
and
3 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
client/src/core/client/admin/components/ModerateCard/DecisionDetailsContainer.css
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,29 @@ | ||
.wrapper { | ||
background-color: var(--palette-grey-200); | ||
font-family: var(--font-family-primary); | ||
} | ||
|
||
.full { | ||
width: 100%; | ||
} | ||
|
||
.label { | ||
font-size: var(--font-size-1); | ||
font-weight: var(--font-weight-primary-semi-bold); | ||
text-transform: uppercase; | ||
color: var(--palette-grey-500); | ||
} | ||
|
||
.rejected { | ||
color: var(--palette-text-000); | ||
background-color: var(--palette-error-500); | ||
text-transform: uppercase; | ||
padding: var(--spacing-1) var(--spacing-2); | ||
width: fit-content; | ||
font-size: var(--font-size-1); | ||
font-weight: var(--font-weight-primary-semi-bold); | ||
} | ||
|
||
.info { | ||
font-size: var(--font-size-2); | ||
} |
102 changes: 102 additions & 0 deletions
102
client/src/core/client/admin/components/ModerateCard/DecisionDetailsContainer.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,102 @@ | ||
import { Localized } from "@fluent/react/compat"; | ||
import React, { FunctionComponent } from "react"; | ||
import { graphql } from "react-relay"; | ||
|
||
import { withFragmentContainer } from "coral-framework/lib/relay"; | ||
import { Flex, HorizontalGutter, Timestamp } from "coral-ui/components/v2"; | ||
|
||
import { DecisionDetailsContainer_comment } from "coral-admin/__generated__/DecisionDetailsContainer_comment.graphql"; | ||
|
||
import styles from "./DecisionDetailsContainer.css"; | ||
|
||
import { unsnake } from "../ModerationReason/formatting"; | ||
|
||
interface Props { | ||
comment: DecisionDetailsContainer_comment; | ||
} | ||
|
||
const DecisionDetailsContainer: FunctionComponent<Props> = ({ comment }) => { | ||
const statusHistory = comment.statusHistory.edges[0].node; | ||
const { rejectionReason, createdAt } = statusHistory; | ||
|
||
return ( | ||
<HorizontalGutter className={styles.wrapper} padding={3}> | ||
<Flex> | ||
<Flex direction="column" className={styles.full}> | ||
<Localized id="moderate-decisionDetails-decisionLabel"> | ||
<div className={styles.label}>Decision</div> | ||
</Localized> | ||
<Localized id="moderate-decisionDetails-rejected"> | ||
<div className={styles.rejected}>Rejected</div> | ||
</Localized> | ||
</Flex> | ||
{rejectionReason && rejectionReason.code && ( | ||
<Flex direction="column" className={styles.full}> | ||
<Localized id="moderate-decisionDetails-reasonLabel"> | ||
<div className={styles.label}>Reason</div> | ||
</Localized> | ||
<Localized | ||
id={`common-moderationReason-rejectionReason-${rejectionReason.code}`} | ||
> | ||
<div className={styles.info}>{unsnake(rejectionReason.code)}</div> | ||
</Localized> | ||
</Flex> | ||
)} | ||
</Flex> | ||
{rejectionReason?.legalGrounds && ( | ||
<Flex direction="column"> | ||
<Localized id="moderate-decisionDetails-lawBrokenLabel"> | ||
<div className={styles.label}>Law broken</div> | ||
</Localized> | ||
<div className={styles.info}>{rejectionReason?.legalGrounds}</div> | ||
</Flex> | ||
)} | ||
{rejectionReason?.customReason && ( | ||
<Flex direction="column"> | ||
<Localized id="moderate-decisionDetails-customReasonLabel"> | ||
<div className={styles.label}>Custom reason</div> | ||
</Localized> | ||
<div className={styles.info}>{rejectionReason?.customReason}</div> | ||
</Flex> | ||
)} | ||
{rejectionReason?.detailedExplanation && ( | ||
<Flex direction="column"> | ||
<Localized id="moderate-decisionDetails-detailedExplanationLabel"> | ||
<div className={styles.label}>Detailed explanation</div> | ||
</Localized> | ||
<div className={styles.info}> | ||
{rejectionReason?.detailedExplanation} | ||
</div> | ||
</Flex> | ||
)} | ||
<Flex> | ||
<div className={styles.label}> | ||
<Timestamp>{createdAt}</Timestamp> | ||
</div> | ||
</Flex> | ||
</HorizontalGutter> | ||
); | ||
}; | ||
|
||
const enhanced = withFragmentContainer<Props>({ | ||
comment: graphql` | ||
fragment DecisionDetailsContainer_comment on Comment { | ||
id | ||
statusHistory(first: 1) { | ||
edges { | ||
node { | ||
createdAt | ||
rejectionReason { | ||
code | ||
legalGrounds | ||
detailedExplanation | ||
customReason | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
})(DecisionDetailsContainer); | ||
|
||
export default enhanced; |
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
40 changes: 40 additions & 0 deletions
40
client/src/core/client/ui/components/icons/ModerationDecisionIcon.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,40 @@ | ||
import React, { FunctionComponent } from "react"; | ||
|
||
const ModerationDecisionIcon: FunctionComponent = () => { | ||
return ( | ||
<svg viewBox="0 0 30 18" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
stroke="currentColor" | ||
d="M19.5218 9.10378L20.6125 10.0736L23.1824 8.06207" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<path | ||
d="M28.0738 4.4889L18.9097 1.04258C18.9097 1.04258 18.2988 0.812827 18.069 1.42377L13.9334 12.4207C13.9334 12.4207 13.7037 13.0316 14.3146 13.2613L23.4787 16.7077C23.4787 16.7077 24.0896 16.9374 24.3194 16.3265L28.455 5.32959C28.455 5.32959 28.6847 4.71865 28.0738 4.4889Z" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
stroke="currentColor" | ||
/> | ||
<path | ||
d="M12.1194 14.6012L6.51917 16.7069C6.43887 16.7372 6.35336 16.7515 6.26755 16.7487C6.18173 16.746 6.0973 16.7264 6.01909 16.691C5.94087 16.6556 5.87041 16.6051 5.81174 16.5424C5.75307 16.4797 5.70734 16.4061 5.67718 16.3257L1.54159 5.32879C1.51142 5.24856 1.49735 5.16317 1.50018 5.0775C1.503 4.99183 1.52268 4.90756 1.55807 4.82949C1.59347 4.75143 1.64389 4.6811 1.70647 4.62252C1.76905 4.56394 1.84255 4.51826 1.92278 4.48809L11.0869 1.04177C11.2489 0.980839 11.4285 0.986767 11.5861 1.05825C11.7438 1.12974 11.8666 1.26093 11.9275 1.42296L13.9092 6.68251" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
stroke="currentColor" | ||
/> | ||
<path | ||
d="M9.75537 6.77246L7.84945 10.9759" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
stroke="currentColor" | ||
/> | ||
<path | ||
d="M6.70059 7.92139L10.9041 9.82731" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
stroke="currentColor" | ||
/> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default ModerationDecisionIcon; |
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