-
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.
userdashboard/ModerationNotification//AIFeedback: add AI feedback com…
…ponent and add to the ModerationNotification small a11y improvments
- Loading branch information
Showing
7 changed files
with
79 additions
and
19 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
41 changes: 41 additions & 0 deletions
41
apps/userdashboard/assets/js/a4_candy_userdashboard/AIReportExplanation.jsx
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,41 @@ | ||
import React, { useState } from 'react' | ||
import django from 'django' | ||
|
||
const translated = { | ||
intro: django.gettext('This comment contains disinformation. Defakts uses an Artificial ' + | ||
'Intelligence to scan content for disinformation. Disinformation often shows ' + | ||
'certain characteristics that allow for a reliable identification.'), | ||
ariaReadMore: django.gettext('Click to view the AI explanation for reporting this comment.'), | ||
ariaReadLess: django.gettext('Click to hide the AI explanation for reporting this comment.'), | ||
readMore: django.gettext('Read more'), | ||
readLess: django.gettext('Read less') | ||
} | ||
|
||
export const AIReportExplanation = ({ AIReport }) => { | ||
const [isExpanded, setIsExpanded] = useState() | ||
|
||
const toggleExpand = () => { | ||
setIsExpanded(!isExpanded) | ||
} | ||
|
||
return ( | ||
<li className="alert alert--danger d-flex text-start mb-3"> | ||
<i | ||
className="fas fa-exclamation-circle text-danger pt-1 pe-2" | ||
aria-hidden="True" | ||
/> | ||
<p> | ||
{translated.intro + ' '} | ||
{isExpanded && AIReport + ' '} | ||
<button | ||
className="btn--link text-danger" | ||
type="button" | ||
onClick={toggleExpand} | ||
aria-label={isExpanded ? translated.ariaReadLess : translated.ariaReadMore} | ||
> | ||
{isExpanded ? translated.readLess : translated.readMore} | ||
</button> | ||
</p> | ||
</li> | ||
) | ||
} |
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