Repurpose report post modal and re-use for list reporting (#1070)

*  Repupose report post modal and re-use for list reporting

*  Allow reporting a feed generator

*  ♻️ Refactor report modal into one shared component for reporting different collections

*  Adjust report option selector in tests

*  Add test for list reporting

* ♻️  Refactor reason options and add options for list and feedgen

* 🧹 Cleanup remaining todo

* Fix to mutelist react keys

* Fix regression from rebase

* Improve customfeed mobile header

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
This commit is contained in:
Foysal Ahamed 2023-08-15 23:32:06 +02:00 committed by GitHub
parent a5762c2d7d
commit abbc6543f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 354 additions and 363 deletions

View file

@ -11,6 +11,7 @@ export const ListActions = ({
isOwner,
onPressDeleteList,
onPressShareList,
onPressReportList,
reversed = false, // Default value of reversed is false
}: {
isOwner: boolean
@ -19,6 +20,7 @@ export const ListActions = ({
onPressEditList?: () => void
onPressDeleteList?: () => void
onPressShareList?: () => void
onPressReportList?: () => void
reversed?: boolean // New optional prop
}) => {
const pal = usePalette('default')
@ -64,6 +66,17 @@ export const ListActions = ({
onPress={onPressShareList}>
<FontAwesomeIcon icon={'share'} style={[pal.text]} />
</Button>,
!isOwner && (
<Button
key="reportListBtn"
testID="reportListBtn"
type="default"
accessibilityLabel="Report list"
accessibilityHint=""
onPress={onPressReportList}>
<FontAwesomeIcon icon={'circle-exclamation'} style={[pal.text]} />
</Button>
),
]
// If reversed is true, reverse the array to reverse the order of the buttons

View file

@ -45,6 +45,7 @@ export const ListItems = observer(
onPressEditList,
onPressDeleteList,
onPressShareList,
onPressReportList,
renderEmptyState,
testID,
headerOffset = 0,
@ -57,6 +58,7 @@ export const ListItems = observer(
onPressEditList: () => void
onPressDeleteList: () => void
onPressShareList: () => void
onPressReportList: () => void
renderEmptyState?: () => JSX.Element
testID?: string
headerOffset?: number
@ -169,6 +171,7 @@ export const ListItems = observer(
onPressEditList={onPressEditList}
onPressDeleteList={onPressDeleteList}
onPressShareList={onPressShareList}
onPressReportList={onPressReportList}
/>
) : null
} else if (item === ERROR_ITEM) {
@ -208,6 +211,7 @@ export const ListItems = observer(
onPressEditList,
onPressDeleteList,
onPressShareList,
onPressReportList,
onPressTryAgain,
onPressRetryLoadMore,
],
@ -267,6 +271,7 @@ const ListHeader = observer(
onPressEditList,
onPressDeleteList,
onPressShareList,
onPressReportList,
}: {
list: AppBskyGraphDefs.ListView
isOwner: boolean
@ -274,6 +279,7 @@ const ListHeader = observer(
onPressEditList: () => void
onPressDeleteList: () => void
onPressShareList: () => void
onPressReportList: () => void
}) => {
const pal = usePalette('default')
const store = useStores()
@ -319,6 +325,7 @@ const ListHeader = observer(
onPressEditList={onPressEditList}
onToggleSubscribed={onToggleSubscribed}
onPressShareList={onPressShareList}
onPressReportList={onPressReportList}
/>
)}
</View>