diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-03-13 18:18:23 +0000 |
---|---|---|
committer | Samuel Newman <mozzius@protonmail.com> | 2024-03-14 15:30:40 +0000 |
commit | 78a836d2b1ec2ba53bd1cf6c19846c61eb240065 (patch) | |
tree | 4b519bed1b04f6e789d925835dcfaf8ac7b6cd0c /src | |
parent | 7bdaa624b708b11e4c7f711a4de632c1b0daca90 (diff) | |
download | voidsky-78a836d2b1ec2ba53bd1cf6c19846c61eb240065.tar.zst |
add warning to profile as well
Diffstat (limited to 'src')
-rw-r--r-- | src/view/com/profile/ProfileMenu.tsx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/view/com/profile/ProfileMenu.tsx b/src/view/com/profile/ProfileMenu.tsx index 7c6db1ed8..0baa4f394 100644 --- a/src/view/com/profile/ProfileMenu.tsx +++ b/src/view/com/profile/ProfileMenu.tsx @@ -58,6 +58,11 @@ let ProfileMenu = ({ ) const blockPromptControl = Prompt.usePromptControl() + const loggedOutWarningPromptControl = Prompt.usePromptControl() + + const showLoggedOutWarning = React.useMemo(() => { + return !!profile.labels?.find(label => label.val === '!no-unauthenticated') + }, [profile.labels]) const invalidateProfileQuery = React.useCallback(() => { queryClient.invalidateQueries({ @@ -192,7 +197,13 @@ let ProfileMenu = ({ <Menu.Item testID="profileHeaderDropdownShareBtn" label={_(msg`Share`)} - onPress={onPressShare}> + onPress={() => { + if (showLoggedOutWarning) { + loggedOutWarningPromptControl.open() + } else { + onPressShare() + } + }}> <Menu.ItemText> <Trans>Share</Trans> </Menu.ItemText> @@ -310,6 +321,16 @@ let ProfileMenu = ({ } confirmButtonColor={profile.viewer?.blocking ? undefined : 'negative'} /> + + <Prompt.Basic + control={loggedOutWarningPromptControl} + title={_(msg`Note about sharing`)} + description={_( + msg`This profile is only visible to logged-in users. It won't be visible to people who aren't logged in.`, + )} + onConfirm={onPressShare} + confirmButtonCta={_(msg`Share anyway`)} + /> </EventStopper> ) } |