@@ -1,7 +1,7 @@
|
|||||||
import {StyleProp, ViewStyle} from 'react-native'
|
import {StyleProp, ViewStyle} from 'react-native'
|
||||||
import {ModerationCause, ModerationUI} from '@atproto/api'
|
import {ModerationCause, ModerationUI} from '@atproto/api'
|
||||||
|
|
||||||
import {getModerationCauseKey} from '#/lib/moderation'
|
import {getModerationCauseKey, unique} from '#/lib/moderation'
|
||||||
import * as Pills from '#/components/Pills'
|
import * as Pills from '#/components/Pills'
|
||||||
|
|
||||||
export function PostAlerts({
|
export function PostAlerts({
|
||||||
@@ -22,7 +22,7 @@ export function PostAlerts({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Pills.Row size={size} style={[size === 'sm' && {marginLeft: -3}, style]}>
|
<Pills.Row size={size} style={[size === 'sm' && {marginLeft: -3}, style]}>
|
||||||
{modui.alerts.map(cause => (
|
{modui.alerts.filter(unique).map(cause => (
|
||||||
<Pills.Label
|
<Pills.Label
|
||||||
key={getModerationCauseKey(cause)}
|
key={getModerationCauseKey(cause)}
|
||||||
cause={cause}
|
cause={cause}
|
||||||
@@ -30,7 +30,7 @@ export function PostAlerts({
|
|||||||
noBg={size === 'sm'}
|
noBg={size === 'sm'}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{modui.informs.map(cause => (
|
{modui.informs.filter(unique).map(cause => (
|
||||||
<Pills.Label
|
<Pills.Label
|
||||||
key={getModerationCauseKey(cause)}
|
key={getModerationCauseKey(cause)}
|
||||||
cause={cause}
|
cause={cause}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {StyleProp, ViewStyle} from 'react-native'
|
import {StyleProp, ViewStyle} from 'react-native'
|
||||||
import {ModerationDecision} from '@atproto/api'
|
import {ModerationDecision} from '@atproto/api'
|
||||||
|
|
||||||
import {getModerationCauseKey} from '#/lib/moderation'
|
import {getModerationCauseKey, unique} from '#/lib/moderation'
|
||||||
import * as Pills from '#/components/Pills'
|
import * as Pills from '#/components/Pills'
|
||||||
|
|
||||||
export function ProfileHeaderAlerts({
|
export function ProfileHeaderAlerts({
|
||||||
@@ -17,14 +17,14 @@ export function ProfileHeaderAlerts({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Pills.Row size="lg">
|
<Pills.Row size="lg">
|
||||||
{modui.alerts.map(cause => (
|
{modui.alerts.filter(unique).map(cause => (
|
||||||
<Pills.Label
|
<Pills.Label
|
||||||
size="lg"
|
size="lg"
|
||||||
key={getModerationCauseKey(cause)}
|
key={getModerationCauseKey(cause)}
|
||||||
cause={cause}
|
cause={cause}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{modui.informs.map(cause => (
|
{modui.informs.filter(unique).map(cause => (
|
||||||
<Pills.Label
|
<Pills.Label
|
||||||
size="lg"
|
size="lg"
|
||||||
key={getModerationCauseKey(cause)}
|
key={getModerationCauseKey(cause)}
|
||||||
|
|||||||
@@ -137,3 +137,15 @@ export function useLabelSubject({label}: {label: ComAtprotoLabelDefs.Label}): {
|
|||||||
}
|
}
|
||||||
}, [label])
|
}, [label])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function unique(
|
||||||
|
value: ModerationCause,
|
||||||
|
index: number,
|
||||||
|
array: ModerationCause[],
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
array.findIndex(
|
||||||
|
item => getModerationCauseKey(item) === getModerationCauseKey(value),
|
||||||
|
) === index
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -199,7 +199,6 @@ const styles = StyleSheet.create({
|
|||||||
height: 30,
|
height: 30,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
borderRadius: 15,
|
borderRadius: 15,
|
||||||
// @ts-ignore web only
|
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
|||||||
Reference in New Issue
Block a user