diff options
Diffstat (limited to 'src/view/com/modals')
-rw-r--r-- | src/view/com/modals/LinkActions.tsx | 72 | ||||
-rw-r--r-- | src/view/com/modals/Modal.tsx | 18 | ||||
-rw-r--r-- | src/view/com/modals/SharePost.native.tsx | 43 | ||||
-rw-r--r-- | src/view/com/modals/SharePost.tsx | 57 |
4 files changed, 1 insertions, 189 deletions
diff --git a/src/view/com/modals/LinkActions.tsx b/src/view/com/modals/LinkActions.tsx deleted file mode 100644 index deb1518ec..000000000 --- a/src/view/com/modals/LinkActions.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import React from 'react' -import Toast from '../util/Toast' -import Clipboard from '@react-native-clipboard/clipboard' -import {StyleSheet, Text, TouchableOpacity, View} from 'react-native' -import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' -import {useStores} from '../../../state' -import {s, colors} from '../../lib/styles' - -export const snapPoints = ['30%'] - -export function Component({ - title, - href, - newTab, -}: { - title: string - href: string - newTab: boolean -}) { - const store = useStores() - - const onPressOpenNewTab = () => { - store.shell.closeModal() - store.nav.newTab(href) - } - - const onPressCopy = () => { - Clipboard.setString(href) - store.shell.closeModal() - Toast.show('Link copied', { - position: Toast.positions.TOP, - }) - } - - return ( - <View> - <Text style={[s.textCenter, s.bold, s.mb10, s.f16]}>{title || href}</Text> - <View style={s.p10}> - {newTab ? ( - <TouchableOpacity onPress={onPressOpenNewTab} style={styles.btn}> - <FontAwesomeIcon - icon="arrow-up-right-from-square" - style={styles.icon} - /> - <Text style={[s.f16, s.black]}>Open in new tab</Text> - </TouchableOpacity> - ) : undefined} - <TouchableOpacity onPress={onPressCopy} style={styles.btn}> - <FontAwesomeIcon icon="link" style={styles.icon} /> - <Text style={[s.f16, s.black]}>Copy to clipboard</Text> - </TouchableOpacity> - </View> - </View> - ) -} - -const styles = StyleSheet.create({ - btn: { - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'center', - width: '100%', - borderColor: colors.gray5, - borderWidth: 1, - borderRadius: 4, - padding: 10, - marginBottom: 10, - }, - icon: { - marginRight: 8, - }, -}) diff --git a/src/view/com/modals/Modal.tsx b/src/view/com/modals/Modal.tsx index 3317fef08..9d7033411 100644 --- a/src/view/com/modals/Modal.tsx +++ b/src/view/com/modals/Modal.tsx @@ -7,9 +7,7 @@ import {createCustomBackdrop} from '../util/BottomSheetCustomBackdrop' import * as models from '../../../state/models/shell-ui' -import * as LinkActionsModal from './LinkActions' import * as ConfirmModal from './Confirm' -import * as SharePostModal from './SharePost.native' import * as EditProfileModal from './EditProfile' import * as CreateSceneModal from './CreateScene' import * as InviteToSceneModal from './InviteToScene' @@ -41,27 +39,13 @@ export const Modal = observer(function Modal() { let snapPoints: (string | number)[] = CLOSED_SNAPPOINTS let element - if (store.shell.activeModal?.name === 'link-actions') { - snapPoints = LinkActionsModal.snapPoints - element = ( - <LinkActionsModal.Component - {...(store.shell.activeModal as models.LinkActionsModel)} - /> - ) - } else if (store.shell.activeModal?.name === 'confirm') { + if (store.shell.activeModal?.name === 'confirm') { snapPoints = ConfirmModal.snapPoints element = ( <ConfirmModal.Component {...(store.shell.activeModal as models.ConfirmModel)} /> ) - } else if (store.shell.activeModal?.name === 'share-post') { - snapPoints = SharePostModal.snapPoints - element = ( - <SharePostModal.Component - {...(store.shell.activeModal as models.SharePostModel)} - /> - ) } else if (store.shell.activeModal?.name === 'edit-profile') { snapPoints = EditProfileModal.snapPoints element = ( diff --git a/src/view/com/modals/SharePost.native.tsx b/src/view/com/modals/SharePost.native.tsx deleted file mode 100644 index 01692fb74..000000000 --- a/src/view/com/modals/SharePost.native.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react' -import {Button, StyleSheet, Text, TouchableOpacity, View} from 'react-native' -import Toast from '../util/Toast' -import Clipboard from '@react-native-clipboard/clipboard' -import {s} from '../../lib/styles' -import {useStores} from '../../../state' - -export const snapPoints = ['30%'] - -export function Component({href}: {href: string}) { - const store = useStores() - const onPressCopy = () => { - Clipboard.setString(href) - Toast.show('Link copied', { - position: Toast.positions.TOP, - }) - store.shell.closeModal() - } - const onClose = () => store.shell.closeModal() - - return ( - <View> - <Text style={[s.textCenter, s.bold, s.mb10]}>Share this post</Text> - <Text style={[s.textCenter, s.mb10]}>{href}</Text> - <Button title="Copy to clipboard" onPress={onPressCopy} /> - <View style={s.p10}> - <TouchableOpacity onPress={onClose} style={styles.closeBtn}> - <Text style={s.textCenter}>Close</Text> - </TouchableOpacity> - </View> - </View> - ) -} - -const styles = StyleSheet.create({ - closeBtn: { - width: '100%', - borderColor: '#000', - borderWidth: 1, - borderRadius: 4, - padding: 10, - }, -}) diff --git a/src/view/com/modals/SharePost.tsx b/src/view/com/modals/SharePost.tsx deleted file mode 100644 index d6d4bb5c1..000000000 --- a/src/view/com/modals/SharePost.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import React, {forwardRef, useState, useImperativeHandle} from 'react' -import {Button, StyleSheet, Text, TouchableOpacity, View} from 'react-native' -import {Modal} from './WebModal' -import Toast from '../util/Toast' -import {s} from '../../lib/styles' - -export const ShareModal = forwardRef(function ShareModal({}: {}, ref) { - const [isOpen, setIsOpen] = useState<boolean>(false) - const [uri, setUri] = useState<string>('') - - useImperativeHandle(ref, () => ({ - open(uri: string) { - console.log('sharing', uri) - setUri(uri) - setIsOpen(true) - }, - })) - - const onPressCopy = () => { - // TODO - Toast.show('Link copied', { - position: Toast.positions.TOP, - }) - } - const onClose = () => { - setIsOpen(false) - } - - return ( - <> - {isOpen && ( - <Modal onClose={onClose}> - <View> - <Text style={[s.textCenter, s.bold, s.mb10]}>Share this post</Text> - <Text style={[s.textCenter, s.mb10]}>{uri}</Text> - <Button title="Copy to clipboard" onPress={onPressCopy} /> - <View style={s.p10}> - <TouchableOpacity onPress={onClose} style={styles.closeBtn}> - <Text style={s.textCenter}>Close</Text> - </TouchableOpacity> - </View> - </View> - </Modal> - )} - </> - ) -}) - -const styles = StyleSheet.create({ - closeBtn: { - width: '100%', - borderColor: '#000', - borderWidth: 1, - borderRadius: 4, - padding: 10, - }, -}) |