about summary refs log tree commit diff
path: root/src/view/com/util
diff options
context:
space:
mode:
authorJohn Fawcett <jrf0110@gmail.com>2023-04-12 20:27:55 -0500
committerGitHub <noreply@github.com>2023-04-12 18:27:55 -0700
commitf6769b283fe83d7abbc0545077b3dca978184eed (patch)
treefab3973591fd0514d290de18f37280baca5563f9 /src/view/com/util
parent2fed6c402159c6084dd481ab87c5e8b034e910ac (diff)
downloadvoidsky-f6769b283fe83d7abbc0545077b3dca978184eed.tar.zst
Mobile Web (#427)
* WIP

* WIP

* Fix header offset on web

* Remove debug

* Fix web mobile feed and FAB layout

* Fix modals on mobile web

* Remove dead code

* Remove ios config that shouldnt be committed now

* Move bottom bar into its own folder

* Fix web drawer navigation and state behaviors

* Remove dark mode toggle from web drawer for now

* Fix search on mobile web

* Fix the logged out splash screen on mobile web

* Fixes to detox simulator

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/com/util')
-rw-r--r--src/view/com/util/FAB.tsx71
-rw-r--r--src/view/com/util/FAB.web.tsx8
-rw-r--r--src/view/com/util/Toast.web.tsx5
-rw-r--r--src/view/com/util/fab/FAB.tsx1
-rw-r--r--src/view/com/util/fab/FAB.web.tsx14
-rw-r--r--src/view/com/util/fab/FABInner.tsx72
6 files changed, 90 insertions, 81 deletions
diff --git a/src/view/com/util/FAB.tsx b/src/view/com/util/FAB.tsx
deleted file mode 100644
index 3427d368e..000000000
--- a/src/view/com/util/FAB.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import React from 'react'
-import {observer} from 'mobx-react-lite'
-import {
-  Animated,
-  GestureResponderEvent,
-  StyleSheet,
-  TouchableWithoutFeedback,
-} from 'react-native'
-import LinearGradient from 'react-native-linear-gradient'
-import {gradients} from 'lib/styles'
-import {useAnimatedValue} from 'lib/hooks/useAnimatedValue'
-import {useStores} from 'state/index'
-
-type OnPress = ((event: GestureResponderEvent) => void) | undefined
-export const FAB = observer(
-  ({
-    testID,
-    icon,
-    onPress,
-  }: {
-    testID?: string
-    icon: JSX.Element
-    onPress: OnPress
-  }) => {
-    const store = useStores()
-    const interp = useAnimatedValue(0)
-    React.useEffect(() => {
-      Animated.timing(interp, {
-        toValue: store.shell.minimalShellMode ? 1 : 0,
-        duration: 100,
-        useNativeDriver: true,
-        isInteraction: false,
-      }).start()
-    }, [interp, store.shell.minimalShellMode])
-    const transform = {
-      transform: [{translateY: Animated.multiply(interp, 60)}],
-    }
-    return (
-      <TouchableWithoutFeedback testID={testID} onPress={onPress}>
-        <Animated.View style={[styles.outer, transform]}>
-          <LinearGradient
-            colors={[gradients.blueLight.start, gradients.blueLight.end]}
-            start={{x: 0, y: 0}}
-            end={{x: 1, y: 1}}
-            style={styles.inner}>
-            {icon}
-          </LinearGradient>
-        </Animated.View>
-      </TouchableWithoutFeedback>
-    )
-  },
-)
-
-const styles = StyleSheet.create({
-  outer: {
-    position: 'absolute',
-    zIndex: 1,
-    right: 28,
-    bottom: 94,
-    width: 60,
-    height: 60,
-    borderRadius: 30,
-  },
-  inner: {
-    width: 60,
-    height: 60,
-    borderRadius: 30,
-    justifyContent: 'center',
-    alignItems: 'center',
-  },
-})
diff --git a/src/view/com/util/FAB.web.tsx b/src/view/com/util/FAB.web.tsx
deleted file mode 100644
index dcffef29e..000000000
--- a/src/view/com/util/FAB.web.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import React from 'react'
-import {GestureResponderEvent, View} from 'react-native'
-import {IconProp} from '@fortawesome/fontawesome-svg-core'
-
-type OnPress = ((event: GestureResponderEvent) => void) | undefined
-export const FAB = (_opts: {icon: IconProp; onPress: OnPress}) => {
-  return <View />
-}
diff --git a/src/view/com/util/Toast.web.tsx b/src/view/com/util/Toast.web.tsx
index bce178b4c..cfde68536 100644
--- a/src/view/com/util/Toast.web.tsx
+++ b/src/view/com/util/Toast.web.tsx
@@ -55,9 +55,10 @@ export function show(text: string) {
 const styles = StyleSheet.create({
   container: {
     position: 'absolute',
-    right: 20,
+    left: 20,
     bottom: 20,
-    width: 350,
+    width: 'calc(100% - 40px)',
+    maxWidth: 350,
     padding: 20,
     flexDirection: 'row',
     alignItems: 'center',
diff --git a/src/view/com/util/fab/FAB.tsx b/src/view/com/util/fab/FAB.tsx
new file mode 100644
index 000000000..b222fe45c
--- /dev/null
+++ b/src/view/com/util/fab/FAB.tsx
@@ -0,0 +1 @@
+export {FABInner as FAB} from './FABInner'
diff --git a/src/view/com/util/fab/FAB.web.tsx b/src/view/com/util/fab/FAB.web.tsx
new file mode 100644
index 000000000..0a8831fa9
--- /dev/null
+++ b/src/view/com/util/fab/FAB.web.tsx
@@ -0,0 +1,14 @@
+import React from 'react'
+import {View} from 'react-native'
+import {FABInner, FABProps} from './FABInner'
+import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
+
+export const FAB = (_opts: FABProps) => {
+  const {isDesktop} = useWebMediaQueries()
+
+  if (!isDesktop) {
+    return <FABInner {..._opts} />
+  }
+
+  return <View />
+}
diff --git a/src/view/com/util/fab/FABInner.tsx b/src/view/com/util/fab/FABInner.tsx
new file mode 100644
index 000000000..3d44c0dd4
--- /dev/null
+++ b/src/view/com/util/fab/FABInner.tsx
@@ -0,0 +1,72 @@
+import React from 'react'
+import {observer} from 'mobx-react-lite'
+import {
+  Animated,
+  GestureResponderEvent,
+  StyleSheet,
+  TouchableWithoutFeedback,
+} from 'react-native'
+import LinearGradient from 'react-native-linear-gradient'
+import {gradients} from 'lib/styles'
+import {useAnimatedValue} from 'lib/hooks/useAnimatedValue'
+import {useStores} from 'state/index'
+import {isMobileWeb} from 'platform/detection'
+
+type OnPress = ((event: GestureResponderEvent) => void) | undefined
+export interface FABProps {
+  testID?: string
+  icon: JSX.Element
+  onPress: OnPress
+}
+
+export const FABInner = observer(({testID, icon, onPress}: FABProps) => {
+  const store = useStores()
+  const interp = useAnimatedValue(0)
+  React.useEffect(() => {
+    Animated.timing(interp, {
+      toValue: store.shell.minimalShellMode ? 1 : 0,
+      duration: 100,
+      useNativeDriver: true,
+      isInteraction: false,
+    }).start()
+  }, [interp, store.shell.minimalShellMode])
+  const transform = {
+    transform: [{translateY: Animated.multiply(interp, 60)}],
+  }
+  return (
+    <TouchableWithoutFeedback testID={testID} onPress={onPress}>
+      <Animated.View
+        style={[styles.outer, isMobileWeb && styles.mobileWebOuter, transform]}>
+        <LinearGradient
+          colors={[gradients.blueLight.start, gradients.blueLight.end]}
+          start={{x: 0, y: 0}}
+          end={{x: 1, y: 1}}
+          style={styles.inner}>
+          {icon}
+        </LinearGradient>
+      </Animated.View>
+    </TouchableWithoutFeedback>
+  )
+})
+
+const styles = StyleSheet.create({
+  outer: {
+    position: 'absolute',
+    zIndex: 1,
+    right: 28,
+    bottom: 94,
+    width: 60,
+    height: 60,
+    borderRadius: 30,
+  },
+  mobileWebOuter: {
+    bottom: 114,
+  },
+  inner: {
+    width: 60,
+    height: 60,
+    borderRadius: 30,
+    justifyContent: 'center',
+    alignItems: 'center',
+  },
+})