diff --git a/native/invite-links/view-invite-links-screen.react.js b/native/invite-links/view-invite-links-screen.react.js --- a/native/invite-links/view-invite-links-screen.react.js +++ b/native/invite-links/view-invite-links-screen.react.js @@ -6,13 +6,18 @@ import { TouchableOpacity } from 'react-native-gesture-handler'; import { primaryInviteLinksSelector } from 'lib/selectors/invite-links-selectors.js'; +import { threadHasPermission } from 'lib/shared/thread-utils.js'; import type { InviteLink } from 'lib/types/link-types.js'; +import { threadPermissions } from 'lib/types/thread-permission-types.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; import SWMansionIcon from '../components/swmansion-icon.react.js'; import { displayActionResultModal } from '../navigation/action-result-modal.js'; import type { RootNavigationProp } from '../navigation/root-navigator.react.js'; -import type { NavigationRoute } from '../navigation/route-names.js'; +import { + ManagePublicLinkRouteName, + type NavigationRoute, +} from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { useStyles, useColors } from '../themes/colors.js'; @@ -41,8 +46,42 @@ setTimeout(confirmCopy); }, [linkUrl]); + const { navigate } = props.navigation; + const onEditButtonClick = React.useCallback(() => { + navigate<'ManagePublicLink'>({ + name: ManagePublicLinkRouteName, + params: { + community, + }, + }); + }, [community, navigate]); + const canManageLinks = threadHasPermission( + community, + threadPermissions.MANAGE_INVITE_LINKS, + ); let publicLinkSection = null; - if (inviteLink) { + if (inviteLink || canManageLinks) { + let description; + if (canManageLinks) { + description = ( + <> + + Public links allow unlimited uses and never expire. + + + + Edit public link + + + + ); + } else { + description = ( + + Use this public link to invite your friends into the community! + + ); + } publicLinkSection = ( <> PUBLIC LINK @@ -58,9 +97,7 @@ Copy - - Use this public link to invite your friends into the community! - + {description} ); @@ -92,6 +129,7 @@ link: { paddingHorizontal: 16, paddingVertical: 9, + marginBottom: 16, backgroundColor: 'inviteLinkButtonBackground', borderRadius: 20, flexDirection: 'row', @@ -119,7 +157,9 @@ fontWeight: '400', lineHeight: 18, color: 'modalForegroundLabel', - paddingTop: 16, + }, + editLinkButton: { + color: 'purpleLink', }, };