Skip to content

Commit 69d4abd

Browse files
authored
Merge pull request #50 from ansari-project/add-content-flagging-option
Introduce an option to flag offensive content
2 parents ffa9b14 + 0348750 commit 69d4abd

File tree

11 files changed

+125
-48
lines changed

11 files changed

+125
-48
lines changed

src/components/chat/ReactionButtons.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CheckIcon, CloseIcon, CopyIcon, DislikeIcon, LikeIcon } from '@/components/svg'
1+
import { CheckIcon, CloseIcon, CopyIcon, DislikeIcon, FlagIcon, LikeIcon } from '@/components/svg'
22
import { useDirection, useFeedbackHandler, useFeedbackService, useScreenInfo } from '@/hooks'
33
import { FeedbackClass, Message, ReactionButtonsState, RootState } from '@/store'
44
import { createGeneralThemedStyles } from '@/utils'
@@ -86,6 +86,10 @@ const ReactionButtons: React.FC<ReactionButtonsProps> = ({ threadId, messageId,
8686
feedbackOptions = feedbacks.bad || []
8787
}
8888

89+
if (selectedFeedbackClass === FeedbackClass.RedFlag) {
90+
feedbackOptions = feedbacks.redflag || []
91+
}
92+
8993
return (
9094
<View className='flex-row flex-wrap gap-x-2'>
9195
{feedbackOptions.map((option) => (
@@ -154,6 +158,21 @@ const ReactionButtons: React.FC<ReactionButtonsProps> = ({ threadId, messageId,
154158
height={24}
155159
/>
156160
</Pressable>
161+
<Pressable
162+
onPress={() => {
163+
handleFeedbackAction(FeedbackClass.RedFlag)
164+
setEditing(true)
165+
}}
166+
className={`w-5 h-5 ${isRTL ? 'mr-2' : 'ml-2'}`}
167+
hitSlop={8}
168+
>
169+
<FlagIcon
170+
fill={selectedIcon === FeedbackClass.RedFlag ? theme.hoverColor : theme.iconFill}
171+
hoverFill={theme.hoverColor}
172+
width={24}
173+
height={24}
174+
/>
175+
</Pressable>
157176
</View>
158177
{modalVisible && (
159178
<View className={`w-full mt-6 ${modalVisible ? 'h-auto' : ''}`}>

src/components/svg/FlagIcon.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const FlagIcon: React.FC<Props> = (props: Props) => {
1212
width={props.width || '24'}
1313
height={props.height || '24'}
1414
viewBox={props.viewBox || '0 0 24 24'}
15-
fill={props.fill || '#08786B'}
15+
fill={props.fill || 'currentColor'}
16+
stroke={props.stroke || 'currentColor'}
1617
transform={props.transform || transform}
1718
>
1819
<G>

src/i18n/locales/ar/feedback.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
}
1818
],
1919
"bad": [
20-
{
21-
"id": "bad1",
22-
"label": "مضارب / غير آمن",
23-
"value": "offensive"
24-
},
2520
{
2621
"id": "bad2",
2722
"label": "لا يكون صحيحاً في الواقع",
@@ -32,5 +27,17 @@
3227
"label": "أخرى",
3328
"value": "other"
3429
}
30+
],
31+
"redflag": [
32+
{
33+
"id": "redflag1",
34+
"label": "مضارب / غير آمن",
35+
"value": "offensive"
36+
},
37+
{
38+
"id": "redflag2",
39+
"label": "أخرى",
40+
"value": "other"
41+
}
3542
]
36-
}
43+
}

src/i18n/locales/bs/feedback.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
}
1818
],
1919
"bad": [
20-
{
21-
"id": "bad1",
22-
"label": "Neprikladno / Neposredno",
23-
"value": "offensive"
24-
},
2520
{
2621
"id": "bad2",
2722
"label": "Nepravilno faktično",
@@ -32,5 +27,17 @@
3227
"label": "Drugo",
3328
"value": "other"
3429
}
30+
],
31+
"redflag": [
32+
{
33+
"id": "redflag1",
34+
"label": "Neprikladno / Neposredno",
35+
"value": "offensive"
36+
},
37+
{
38+
"id": "redflag2",
39+
"label": "Drugo",
40+
"value": "other"
41+
}
3542
]
36-
}
43+
}

src/i18n/locales/en/feedback.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
}
1818
],
1919
"bad": [
20-
{
21-
"id": "bad1",
22-
"label": "Offensive / Unsafe",
23-
"value": "offensive"
24-
},
2520
{
2621
"id": "bad2",
2722
"label": "Not factually correct",
@@ -32,5 +27,17 @@
3227
"label": "Other",
3328
"value": "other"
3429
}
30+
],
31+
"redflag": [
32+
{
33+
"id": "redflag1",
34+
"label": "Offensive / Unsafe",
35+
"value": "offensive"
36+
},
37+
{
38+
"id": "redflag2",
39+
"label": "Other",
40+
"value": "other"
41+
}
3542
]
3643
}

src/i18n/locales/fr/feedback.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
}
1818
],
1919
"bad": [
20-
{
21-
"id": "bad1",
22-
"label": "Offensif / Dangereux",
23-
"value": "offensive"
24-
},
2520
{
2621
"id": "bad2",
2722
"label": "Pas exactement correct",
@@ -32,5 +27,17 @@
3227
"label": "Autre",
3328
"value": "other"
3429
}
30+
],
31+
"redflag": [
32+
{
33+
"id": "redflag1",
34+
"label": "Offensif / Dangereux",
35+
"value": "offensive"
36+
},
37+
{
38+
"id": "redflag2",
39+
"label": "Autre",
40+
"value": "other"
41+
}
3542
]
36-
}
43+
}

src/i18n/locales/id/feedback.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
}
1818
],
1919
"bad": [
20-
{
21-
"id": "bad1",
22-
"label": "Kasar / Tidak aman",
23-
"value": "offensive"
24-
},
2520
{
2621
"id": "bad2",
2722
"label": "Tidak benar fakta",
@@ -32,5 +27,17 @@
3227
"label": "Lainnya",
3328
"value": "other"
3429
}
30+
],
31+
"redflag": [
32+
{
33+
"id": "redflag1",
34+
"label": "Kasar / Tidak aman",
35+
"value": "offensive"
36+
},
37+
{
38+
"id": "redflag2",
39+
"label": "Lainnya",
40+
"value": "other"
41+
}
3542
]
36-
}
43+
}

src/i18n/locales/tml/feedback.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
}
1818
],
1919
"bad": [
20-
{
21-
"id": "bad1",
22-
"label": "அவமதிப்பான/மனத்தை புண்படுத்துகிற/பாதுகாப்பற்ற தகவல் ",
23-
"value": "offensive"
24-
},
2520
{
2621
"id": "bad2",
2722
"label": "உண்மையற்றது/தவறான தகவல்",
@@ -32,5 +27,17 @@
3227
"label": "தவறான தகவல்",
3328
"value": "other"
3429
}
30+
],
31+
"redflag": [
32+
{
33+
"id": "redflag1",
34+
"label": "அவமதிப்பான/மனத்தை புண்படுத்துகிற/பாதுகாப்பற்ற தகவல் ",
35+
"value": "offensive"
36+
},
37+
{
38+
"id": "redflag2",
39+
"label": "தவறான தகவல்",
40+
"value": "other"
41+
}
3542
]
3643
}

src/i18n/locales/tur/feedback.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
}
1818
],
1919
"bad": [
20-
{
21-
"id": "bad1",
22-
"label": "Saldırgan / Tehlikeli",
23-
"value": "offensive"
24-
},
2520
{
2621
"id": "bad2",
2722
"label": "Tamamen Doğru Değil",
@@ -32,5 +27,17 @@
3227
"label": "Diğer",
3328
"value": "other"
3429
}
30+
],
31+
"redflag": [
32+
{
33+
"id": "redflag1",
34+
"label": "Saldırgan / Tehlikeli",
35+
"value": "offensive"
36+
},
37+
{
38+
"id": "redflag2",
39+
"label": "Diğer",
40+
"value": "other"
41+
}
3542
]
36-
}
43+
}

src/i18n/locales/ur/feedback.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
}
1818
],
1919
"bad": [
20-
{
21-
"id": "bad1",
22-
"label": "توہین آمیز / نا محفوظ",
23-
"value": "offensive"
24-
},
2520
{
2621
"id": "bad2",
2722
"label": "حقائقی طور پر غلط",
@@ -32,5 +27,17 @@
3227
"label": "دیگر",
3328
"value": "other"
3429
}
30+
],
31+
"redflag": [
32+
{
33+
"id": "redflag1",
34+
"label": "توہین آمیز / نا محفوظ",
35+
"value": "offensive"
36+
},
37+
{
38+
"id": "redflag2",
39+
"label": "دیگر",
40+
"value": "other"
41+
}
3542
]
36-
}
43+
}

0 commit comments

Comments
 (0)