* Add modservice screen and profile-header-card * Drop the guidelines for now * Remove ununsed constants * Add label & label group descriptions * Not found state * Reorg, add icon * Subheader * Header * Complete header * Clean up * Add all groups * Fix scroll view * Dialogs side quest * Remove log * Add (WIP) debug mod page * Dialog solution * Add note * Clean up and reorganize localized moderation strings * Memoize * Add example * Add first ReportDialog screen * Report dialog step 2 * Submit * Integrate updates * Move moderation screen * Migrate buttons * Migrate everything * Rough sketch * Fix types * Update atoms values * Abstract ModerationServiceCard * Hook up data to settings page * Handle subscription * Rough enablement * Rough enablement * Some validation, fixes * More work on the mod debug screen * Hook up data * Update invalidation * Hook up data to ReportDialog * Fix native error * Refactor/rewrite the entire moderation-application system * Fix toggles * Add copyright and other option to report * Handle reports on profile vs content * Little cleanup * Get post hiding back in gear * Better loading flow on Mod screen * Clean up Mod screen * Clean up ProfileMod screen * Handle muting correctly * Update enablement on ProfileMod screen * Improve Moderation screen and dialog * Styling, handle disabled labelers * Rework list of labels on own content * Use moderateNotification() * ReportDialog updates * Fix button overflow * Simplify the ProfileModerationService ui * Mod screen design * Move moderation card from the profile header to a tab * Small tweaks to the moderation screen * Enable toggle on mod page * Add notifs to debugmod and dont filter notifs from followed users * Add moderator-service profile view * Wire up more of the modservice data to profiles * A bunch of speculative non-working UI * Cleanup: delete old code * Update ModerationDetailsDialog * Update ReportDialog * Update LabelsOnMe dialog * Handle ReportDialog load better * Rename LabelsOnMeDialog, fix close * Experiment to put labeling under a tab of a normal profile * Moderator variation of profile * Remove dead code and start moving toward latest modsdk * Remove a bunch of now-dead label strings * Update ModDebug to be a bit more intuitive and support custom labels * Minor ui tweaks * Improve consistency of display name blurring * Fix profile-card warning rendering * More debugmod UI tuning * Update to use new labeler semantics * Delete some dead code and do some refactoring * Update profile to pull from labeler definition * Implement new label config controls (wip) * Tweak ui * Implement preference controls on labelers * Rework label pref ui * Get moderation screen working * Add asyncstorage query persistence * Implement label handling * Small cleanup * Implement Likes dialog * Fix: remove text outside of text element * Cleanup * Fix likes dialog on mobile * Implement the label appeal flow * Get report flow working again with temporarily fixed report options * Update onboarding * Enforce limit of ten labeler subscriptions * Fix type errors * Fix lint errors * Improve types of RQ * Some work on Likes dialog, needs discussion * Bit of ReportDialog cleanup * Replace non-single-path SVG * Update nudity descriptions * Update to use new sdk updates * Add adult-content-enabled behavior to label config * Use the default setting of custom labels * Handle global moderation label prefs with the global settings * Fix missing postAuthor * Fix empty moderation page * Add mutewords control back to Mod screen * Tweak adult setting styles * Remove deprecated global labels * Handle underage users on mod screen * Adjust font sizes * Swap in RichText * Like button improvements * Tweaks to Labeler profile * Design tweaks for mod pref dialog * Add tertiary button color * Switch moderation UIs to tertiary color * Update mutewords and hiddenposts to use the new sdk * Add test-environment mod authority * Switch 'gore' to 'graphic-media' * Move nudity out of the adult content control * Remove focus styles from buttons - let the browser behavior handle it * Fixes to the adult content age-gating in moderaiton * Ditch tertiary button color, lighten secondary button * Fix some colors * Remove focused overrides from toggles * Liked by screen * Rework the moderationlabelpref * Fix optimistic like * Cleanup * Change how onboarding handles adult content enabled/disabled * Add special handling of the mod authorities * Tweaks * Update the default labeler avatar to a shield * Add route to go server * Avoid dups due to bad config * Fix attrs * Fix: dont try to detect link/label mismatches on post meta * Correctly show the label behavior when adult content is disabled * Readd the local hiddenPosts handling * WIP * Fix bad merge * Conten hider design tweaks * Fix text string breakage * Adjust source text in ContentHider * Fix link bug * Design tweaks to ContentHider and ModDetailsDialog * Adjust spacing of inform badges * Adjust spacing of embeds in posts * Style tweaks to post/profile alerts * Labels on me and dialog * Remove bad focus styles from post dropdown * Better spacing solution * Tune moderation UIs * Moderation UI tweaks for mobile * Move labelers query on Mod screen * Update to use new SDK appLabelers semantics * Implement report submission * Replace the report modal entirely with the report dialog * Add @ to mod details dialog handle * Bump SDK package * Remove silly type * Add to AWS build CI * Fix ToggleButton overflow * Clean up ModServiceCard, rename to LabelingServiceCard * Hackfix to translate gore labels to graphic-media * Tune content hider sizing on web desktop * Handle self labels * Fix spacing below text-only posts * Fix: send appeals to the right labeler * Give mod page links interactive states * Fix references * Remove focus handling * Remove remnant * Remove the like count from the subscribed labeler listing * Bump @atproto/api@0.11.1 * Remove extra @ * Fix: persist labels to local storage to reduce coverage gaps * update dipendencies * revert dipendencies * Add some explainers on how blocking affects labelers * Tweak copy * Fix underline color in header * Fix profile menu * Handle card overflow * Remove metrics from header * Mute 'account' not 'user' * Show metrics if self * Show the labels tab on logged out view * Fix bad merge * Use purple theming on labelers * Tighten space on LabelerCard * Set staleTime to 6hrs for labeler details * Memoize the memoizers * Drop staleTime to 60s * Move label defs into a context to reduce recomputes * Submit view tweaks * Move labeler fetch below auth * Mitigation: hardcode the bluesky moderation labeler name * Bump sdk * Add missing translated string Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Add missing translated string Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Hailey's fix for incorrect profile tabs Co-authored-by: Hailey <me@haileyok.com> * Feedback * Fix borders, add bottom space * Hailey's fix pt 2 Co-authored-by: Hailey <me@haileyok.com> * Fix post tabs * Integrate feedback pt 1 Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Integrate feedback pt 2 Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Integrate feedback pt 3 Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Integrate feedback pt 4 Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Integrate feedback pt 5 Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Integrate feedback pt 6 Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Integrate feedback pt 7 Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Integrate feedback pt 8 Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> * Format * Integrate new bday modal * Use public agent for getServices * Update casing --------- Co-authored-by: Eric Bailey <git@esb.lol> Co-authored-by: Takayuki KUSANO <65759+tkusano@users.noreply.github.com> Co-authored-by: Hailey <me@haileyok.com>
398 lines
14 KiB
TypeScript
398 lines
14 KiB
TypeScript
import React, {memo, useMemo} from 'react'
|
|
import {Image, StyleSheet, TouchableOpacity, View} from 'react-native'
|
|
import Svg, {Circle, Rect, Path} from 'react-native-svg'
|
|
import {Image as RNImage} from 'react-native-image-crop-picker'
|
|
import {useLingui} from '@lingui/react'
|
|
import {msg, Trans} from '@lingui/macro'
|
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
|
import {ModerationUI} from '@atproto/api'
|
|
|
|
import {HighPriorityImage} from 'view/com/util/images/Image'
|
|
import {openCamera, openCropper, openPicker} from '../../../lib/media/picker'
|
|
import {
|
|
usePhotoLibraryPermission,
|
|
useCameraPermission,
|
|
} from 'lib/hooks/usePermissions'
|
|
import {colors} from 'lib/styles'
|
|
import {usePalette} from 'lib/hooks/usePalette'
|
|
import {isWeb, isAndroid, isNative} from 'platform/detection'
|
|
import {UserPreviewLink} from './UserPreviewLink'
|
|
import * as Menu from '#/components/Menu'
|
|
import {
|
|
Camera_Stroke2_Corner0_Rounded as Camera,
|
|
Camera_Filled_Stroke2_Corner0_Rounded as CameraFilled,
|
|
} from '#/components/icons/Camera'
|
|
import {StreamingLive_Stroke2_Corner0_Rounded as Library} from '#/components/icons/StreamingLive'
|
|
import {Trash_Stroke2_Corner0_Rounded as Trash} from '#/components/icons/Trash'
|
|
import {useTheme, tokens} from '#/alf'
|
|
|
|
export type UserAvatarType = 'user' | 'algo' | 'list' | 'labeler'
|
|
|
|
interface BaseUserAvatarProps {
|
|
type?: UserAvatarType
|
|
size: number
|
|
avatar?: string | null
|
|
}
|
|
|
|
interface UserAvatarProps extends BaseUserAvatarProps {
|
|
moderation?: ModerationUI
|
|
usePlainRNImage?: boolean
|
|
}
|
|
|
|
interface EditableUserAvatarProps extends BaseUserAvatarProps {
|
|
onSelectNewAvatar: (img: RNImage | null) => void
|
|
}
|
|
|
|
interface PreviewableUserAvatarProps extends BaseUserAvatarProps {
|
|
moderation?: ModerationUI
|
|
did: string
|
|
handle: string
|
|
}
|
|
|
|
const BLUR_AMOUNT = isWeb ? 5 : 100
|
|
|
|
let DefaultAvatar = ({
|
|
type,
|
|
size,
|
|
}: {
|
|
type: UserAvatarType
|
|
size: number
|
|
}): React.ReactNode => {
|
|
if (type === 'algo') {
|
|
// Font Awesome Pro 6.4.0 by @fontawesome -https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc.
|
|
return (
|
|
<Svg
|
|
testID="userAvatarFallback"
|
|
width={size}
|
|
height={size}
|
|
viewBox="0 0 32 32"
|
|
fill="none"
|
|
stroke="none">
|
|
<Rect width="32" height="32" rx="4" fill="#0070FF" />
|
|
<Path
|
|
d="M13.5 7.25C13.5 6.55859 14.0586 6 14.75 6C20.9648 6 26 11.0352 26 17.25C26 17.9414 25.4414 18.5 24.75 18.5C24.0586 18.5 23.5 17.9414 23.5 17.25C23.5 12.418 19.582 8.5 14.75 8.5C14.0586 8.5 13.5 7.94141 13.5 7.25ZM8.36719 14.6172L12.4336 18.6836L13.543 17.5742C13.5156 17.4727 13.5 17.3633 13.5 17.25C13.5 16.5586 14.0586 16 14.75 16C15.4414 16 16 16.5586 16 17.25C16 17.9414 15.4414 18.5 14.75 18.5C14.6367 18.5 14.5312 18.4844 14.4258 18.457L13.3164 19.5664L17.3828 23.6328C17.9492 24.1992 17.8438 25.1484 17.0977 25.4414C16.1758 25.8008 15.1758 26 14.125 26C9.63672 26 6 22.3633 6 17.875C6 16.8242 6.19922 15.8242 6.5625 14.9023C6.85547 14.1602 7.80469 14.0508 8.37109 14.6172H8.36719ZM14.75 9.75C18.8906 9.75 22.25 13.1094 22.25 17.25C22.25 17.9414 21.6914 18.5 21 18.5C20.3086 18.5 19.75 17.9414 19.75 17.25C19.75 14.4883 17.5117 12.25 14.75 12.25C14.0586 12.25 13.5 11.6914 13.5 11C13.5 10.3086 14.0586 9.75 14.75 9.75Z"
|
|
fill="white"
|
|
/>
|
|
</Svg>
|
|
)
|
|
}
|
|
if (type === 'list') {
|
|
// Font Awesome Pro 6.4.0 by @fontawesome -https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc.
|
|
return (
|
|
<Svg
|
|
testID="userAvatarFallback"
|
|
width={size}
|
|
height={size}
|
|
viewBox="0 0 32 32"
|
|
fill="none"
|
|
stroke="none">
|
|
<Path
|
|
d="M28 0H4C1.79086 0 0 1.79086 0 4V28C0 30.2091 1.79086 32 4 32H28C30.2091 32 32 30.2091 32 28V4C32 1.79086 30.2091 0 28 0Z"
|
|
fill="#0070FF"
|
|
/>
|
|
<Path
|
|
d="M22.1529 22.3542C23.4522 22.4603 24.7593 22.293 25.9899 21.8629C26.0369 21.2838 25.919 20.7032 25.6497 20.1884C25.3805 19.6735 24.9711 19.2454 24.4687 18.9535C23.9663 18.6617 23.3916 18.518 22.8109 18.5392C22.2303 18.5603 21.6676 18.7454 21.1878 19.0731M22.1529 22.3542C22.1489 21.1917 21.8142 20.0534 21.1878 19.0741ZM10.8111 19.0741C10.3313 18.7468 9.7687 18.5619 9.18826 18.5409C8.60781 18.5199 8.03327 18.6636 7.53107 18.9554C7.02888 19.2472 6.61953 19.6752 6.35036 20.1899C6.08119 20.7046 5.96319 21.285 6.01001 21.8639C7.23969 22.2964 8.5461 22.4632 9.84497 22.3531M10.8111 19.0741C10.1851 20.0535 9.84865 21.1908 9.84497 22.3531ZM19.0759 10.077C19.0759 10.8931 18.7518 11.6757 18.1747 12.2527C17.5977 12.8298 16.815 13.154 15.9989 13.154C15.1829 13.154 14.4002 12.8298 13.8232 12.2527C13.2461 11.6757 12.922 10.8931 12.922 10.077C12.922 9.26092 13.2461 8.47828 13.8232 7.90123C14.4002 7.32418 15.1829 7 15.9989 7C16.815 7 17.5977 7.32418 18.1747 7.90123C18.7518 8.47828 19.0759 9.26092 19.0759 10.077ZM25.2299 13.154C25.2299 13.457 25.1702 13.7571 25.0542 14.0371C24.9383 14.3171 24.7683 14.5715 24.554 14.7858C24.3397 15.0001 24.0853 15.1701 23.8053 15.2861C23.5253 15.402 23.2252 15.4617 22.9222 15.4617C22.6191 15.4617 22.319 15.402 22.039 15.2861C21.759 15.1701 21.5046 15.0001 21.2903 14.7858C21.0761 14.5715 20.9061 14.3171 20.7901 14.0371C20.6741 13.7571 20.6144 13.457 20.6144 13.154C20.6144 12.5419 20.8576 11.9549 21.2903 11.5222C21.7231 11.0894 22.3101 10.8462 22.9222 10.8462C23.5342 10.8462 24.1212 11.0894 24.554 11.5222C24.9868 11.9549 25.2299 12.5419 25.2299 13.154ZM11.3835 13.154C11.3835 13.457 11.3238 13.7571 11.2078 14.0371C11.0918 14.3171 10.9218 14.5715 10.7075 14.7858C10.4932 15.0001 10.2388 15.1701 9.95886 15.2861C9.67887 15.402 9.37878 15.4617 9.07572 15.4617C8.77266 15.4617 8.47257 15.402 8.19259 15.2861C7.9126 15.1701 7.6582 15.0001 7.4439 14.7858C7.22961 14.5715 7.05962 14.3171 6.94365 14.0371C6.82767 13.7571 6.76798 13.457 6.76798 13.154C6.76798 12.5419 7.01112 11.9549 7.4439 11.5222C7.87669 11.0894 8.46367 10.8462 9.07572 10.8462C9.68777 10.8462 10.2748 11.0894 10.7075 11.5222C11.1403 11.9549 11.3835 12.5419 11.3835 13.154Z"
|
|
fill="white"
|
|
/>
|
|
<Path
|
|
d="M22 22C22 25.3137 19.3137 25.5 16 25.5C12.6863 25.5 10 25.3137 10 22C10 18.6863 12.6863 16 16 16C19.3137 16 22 18.6863 22 22Z"
|
|
fill="white"
|
|
/>
|
|
</Svg>
|
|
)
|
|
}
|
|
if (type === 'labeler') {
|
|
return (
|
|
<Svg
|
|
testID="userAvatarFallback"
|
|
width={size}
|
|
height={size}
|
|
viewBox="0 0 32 32"
|
|
fill="none"
|
|
stroke="none">
|
|
<Path
|
|
d="M28 0H4C1.79086 0 0 1.79086 0 4V28C0 30.2091 1.79086 32 4 32H28C30.2091 32 32 30.2091 32 28V4C32 1.79086 30.2091 0 28 0Z"
|
|
fill={tokens.color.temp_purple}
|
|
/>
|
|
<Path
|
|
d="M24 9.75L16 7L8 9.75V15.9123C8 20.8848 12 23 16 25.1579C20 23 24 20.8848 24 15.9123V9.75Z"
|
|
stroke="white"
|
|
strokeWidth="2"
|
|
strokeLinecap="square"
|
|
strokeLinejoin="round"
|
|
/>
|
|
</Svg>
|
|
)
|
|
}
|
|
return (
|
|
<Svg
|
|
testID="userAvatarFallback"
|
|
width={size}
|
|
height={size}
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="none">
|
|
<Circle cx="12" cy="12" r="12" fill="#0070ff" />
|
|
<Circle cx="12" cy="9.5" r="3.5" fill="#fff" />
|
|
<Path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
fill="#fff"
|
|
d="M 12.058 22.784 C 9.422 22.784 7.007 21.836 5.137 20.262 C 5.667 17.988 8.534 16.25 11.99 16.25 C 15.494 16.25 18.391 18.036 18.864 20.357 C 17.01 21.874 14.64 22.784 12.058 22.784 Z"
|
|
/>
|
|
</Svg>
|
|
)
|
|
}
|
|
DefaultAvatar = memo(DefaultAvatar)
|
|
export {DefaultAvatar}
|
|
|
|
let UserAvatar = ({
|
|
type = 'user',
|
|
size,
|
|
avatar,
|
|
moderation,
|
|
usePlainRNImage = false,
|
|
}: UserAvatarProps): React.ReactNode => {
|
|
const pal = usePalette('default')
|
|
const backgroundColor = pal.colors.backgroundLight
|
|
|
|
const aviStyle = useMemo(() => {
|
|
if (type === 'algo' || type === 'list' || type === 'labeler') {
|
|
return {
|
|
width: size,
|
|
height: size,
|
|
borderRadius: size > 32 ? 8 : 3,
|
|
backgroundColor,
|
|
}
|
|
}
|
|
return {
|
|
width: size,
|
|
height: size,
|
|
borderRadius: Math.floor(size / 2),
|
|
backgroundColor,
|
|
}
|
|
}, [type, size, backgroundColor])
|
|
|
|
const alert = useMemo(() => {
|
|
if (!moderation?.alert) {
|
|
return null
|
|
}
|
|
return (
|
|
<View style={[styles.alertIconContainer, pal.view]}>
|
|
<FontAwesomeIcon
|
|
icon="exclamation-circle"
|
|
style={styles.alertIcon}
|
|
size={Math.floor(size / 3)}
|
|
/>
|
|
</View>
|
|
)
|
|
}, [moderation?.alert, size, pal])
|
|
|
|
return avatar &&
|
|
!((moderation?.blur && isAndroid) /* android crashes with blur */) ? (
|
|
<View style={{width: size, height: size}}>
|
|
{usePlainRNImage ? (
|
|
<Image
|
|
accessibilityIgnoresInvertColors
|
|
testID="userAvatarImage"
|
|
style={aviStyle}
|
|
resizeMode="cover"
|
|
source={{uri: avatar}}
|
|
blurRadius={moderation?.blur ? BLUR_AMOUNT : 0}
|
|
/>
|
|
) : (
|
|
<HighPriorityImage
|
|
testID="userAvatarImage"
|
|
style={aviStyle}
|
|
contentFit="cover"
|
|
source={{uri: avatar}}
|
|
blurRadius={moderation?.blur ? BLUR_AMOUNT : 0}
|
|
/>
|
|
)}
|
|
{alert}
|
|
</View>
|
|
) : (
|
|
<View style={{width: size, height: size}}>
|
|
<DefaultAvatar type={type} size={size} />
|
|
{alert}
|
|
</View>
|
|
)
|
|
}
|
|
UserAvatar = memo(UserAvatar)
|
|
export {UserAvatar}
|
|
|
|
let EditableUserAvatar = ({
|
|
type = 'user',
|
|
size,
|
|
avatar,
|
|
onSelectNewAvatar,
|
|
}: EditableUserAvatarProps): React.ReactNode => {
|
|
const t = useTheme()
|
|
const pal = usePalette('default')
|
|
const {_} = useLingui()
|
|
const {requestCameraAccessIfNeeded} = useCameraPermission()
|
|
const {requestPhotoAccessIfNeeded} = usePhotoLibraryPermission()
|
|
|
|
const aviStyle = useMemo(() => {
|
|
if (type === 'algo' || type === 'list') {
|
|
return {
|
|
width: size,
|
|
height: size,
|
|
borderRadius: size > 32 ? 8 : 3,
|
|
}
|
|
}
|
|
return {
|
|
width: size,
|
|
height: size,
|
|
borderRadius: Math.floor(size / 2),
|
|
}
|
|
}, [type, size])
|
|
|
|
const onOpenCamera = React.useCallback(async () => {
|
|
if (!(await requestCameraAccessIfNeeded())) {
|
|
return
|
|
}
|
|
|
|
onSelectNewAvatar(
|
|
await openCamera({
|
|
width: 1000,
|
|
height: 1000,
|
|
cropperCircleOverlay: true,
|
|
}),
|
|
)
|
|
}, [onSelectNewAvatar, requestCameraAccessIfNeeded])
|
|
|
|
const onOpenLibrary = React.useCallback(async () => {
|
|
if (!(await requestPhotoAccessIfNeeded())) {
|
|
return
|
|
}
|
|
|
|
const items = await openPicker({
|
|
aspect: [1, 1],
|
|
})
|
|
const item = items[0]
|
|
if (!item) {
|
|
return
|
|
}
|
|
|
|
const croppedImage = await openCropper({
|
|
mediaType: 'photo',
|
|
cropperCircleOverlay: true,
|
|
height: item.height,
|
|
width: item.width,
|
|
path: item.path,
|
|
})
|
|
|
|
onSelectNewAvatar(croppedImage)
|
|
}, [onSelectNewAvatar, requestPhotoAccessIfNeeded])
|
|
|
|
const onRemoveAvatar = React.useCallback(() => {
|
|
onSelectNewAvatar(null)
|
|
}, [onSelectNewAvatar])
|
|
|
|
return (
|
|
<Menu.Root>
|
|
<Menu.Trigger label={_(msg`Edit avatar`)}>
|
|
{({props}) => (
|
|
<TouchableOpacity {...props} activeOpacity={0.8}>
|
|
{avatar ? (
|
|
<HighPriorityImage
|
|
testID="userAvatarImage"
|
|
style={aviStyle}
|
|
source={{uri: avatar}}
|
|
accessibilityRole="image"
|
|
/>
|
|
) : (
|
|
<DefaultAvatar type={type} size={size} />
|
|
)}
|
|
<View style={[styles.editButtonContainer, pal.btn]}>
|
|
<CameraFilled height={14} width={14} style={t.atoms.text} />
|
|
</View>
|
|
</TouchableOpacity>
|
|
)}
|
|
</Menu.Trigger>
|
|
<Menu.Outer showCancel>
|
|
<Menu.Group>
|
|
{isNative && (
|
|
<Menu.Item
|
|
testID="changeAvatarCameraBtn"
|
|
label={_(msg`Upload from Camera`)}
|
|
onPress={onOpenCamera}>
|
|
<Menu.ItemText>
|
|
<Trans>Upload from Camera</Trans>
|
|
</Menu.ItemText>
|
|
<Menu.ItemIcon icon={Camera} />
|
|
</Menu.Item>
|
|
)}
|
|
|
|
<Menu.Item
|
|
testID="changeAvatarLibraryBtn"
|
|
label={_(msg`Upload from Library`)}
|
|
onPress={onOpenLibrary}>
|
|
<Menu.ItemText>
|
|
{isNative ? (
|
|
<Trans>Upload from Library</Trans>
|
|
) : (
|
|
<Trans>Upload from Files</Trans>
|
|
)}
|
|
</Menu.ItemText>
|
|
<Menu.ItemIcon icon={Library} />
|
|
</Menu.Item>
|
|
</Menu.Group>
|
|
{!!avatar && (
|
|
<>
|
|
<Menu.Divider />
|
|
<Menu.Group>
|
|
<Menu.Item
|
|
testID="changeAvatarRemoveBtn"
|
|
label={_(`Remove Avatar`)}
|
|
onPress={onRemoveAvatar}>
|
|
<Menu.ItemText>
|
|
<Trans>Remove Avatar</Trans>
|
|
</Menu.ItemText>
|
|
<Menu.ItemIcon icon={Trash} />
|
|
</Menu.Item>
|
|
</Menu.Group>
|
|
</>
|
|
)}
|
|
</Menu.Outer>
|
|
</Menu.Root>
|
|
)
|
|
}
|
|
EditableUserAvatar = memo(EditableUserAvatar)
|
|
export {EditableUserAvatar}
|
|
|
|
let PreviewableUserAvatar = (
|
|
props: PreviewableUserAvatarProps,
|
|
): React.ReactNode => {
|
|
return (
|
|
<UserPreviewLink did={props.did} handle={props.handle}>
|
|
<UserAvatar {...props} />
|
|
</UserPreviewLink>
|
|
)
|
|
}
|
|
PreviewableUserAvatar = memo(PreviewableUserAvatar)
|
|
export {PreviewableUserAvatar}
|
|
|
|
const styles = StyleSheet.create({
|
|
editButtonContainer: {
|
|
position: 'absolute',
|
|
width: 24,
|
|
height: 24,
|
|
bottom: 0,
|
|
right: 0,
|
|
borderRadius: 12,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
backgroundColor: colors.gray5,
|
|
},
|
|
alertIconContainer: {
|
|
position: 'absolute',
|
|
right: 0,
|
|
bottom: 0,
|
|
borderRadius: 100,
|
|
},
|
|
alertIcon: {
|
|
color: colors.red3,
|
|
},
|
|
})
|