about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-10-04 10:53:08 -0500
committerPaul Frazee <pfrazee@gmail.com>2022-10-04 10:53:08 -0500
commitbf39791f011f19c6ff192eb223e15259dc9de53a (patch)
tree2dd108a78cae54565f18c11aade32cc028bd2e5b /src
parentc5ab005908457761abe9a1d67d7e1a4a2796a0fe (diff)
downloadvoidsky-bf39791f011f19c6ff192eb223e15259dc9de53a.tar.zst
Implement a couple missing bits
Diffstat (limited to 'src')
-rw-r--r--src/state/models/notifications-view.ts3
-rw-r--r--src/state/models/shell.ts11
-rw-r--r--src/view/com/modals/LinkActions.tsx26
-rw-r--r--src/view/com/modals/TabsSelector.tsx9
-rw-r--r--src/view/com/profile/ProfileHeader.tsx12
-rw-r--r--src/view/screens/ProfileFollowers.tsx20
-rw-r--r--src/view/screens/ProfileFollows.tsx20
7 files changed, 80 insertions, 21 deletions
diff --git a/src/state/models/notifications-view.ts b/src/state/models/notifications-view.ts
index 620f0ffa6..5528b9f08 100644
--- a/src/state/models/notifications-view.ts
+++ b/src/state/models/notifications-view.ts
@@ -331,7 +331,8 @@ function groupNotifications(
     for (const item2 of items2) {
       if (
         item.reason === item2.reason &&
-        item.reasonSubject === item2.reasonSubject
+        item.reasonSubject === item2.reasonSubject &&
+        item.author.did !== item2.author.did
       ) {
         item2.additional = item2.additional || []
         item2.additional.push(item)
diff --git a/src/state/models/shell.ts b/src/state/models/shell.ts
index 80ecbdd48..3a5376421 100644
--- a/src/state/models/shell.ts
+++ b/src/state/models/shell.ts
@@ -9,11 +9,20 @@ export class TabsSelectorModel {
   }
 }
 
+export interface LinkActionsModelOpts {
+  newTab?: boolean
+}
 export class LinkActionsModel {
   name = 'link-actions'
+  newTab: boolean
 
-  constructor(public href: string, public title: string) {
+  constructor(
+    public href: string,
+    public title: string,
+    opts?: LinkActionsModelOpts,
+  ) {
     makeAutoObservable(this)
+    this.newTab = typeof opts?.newTab === 'boolean' ? opts.newTab : true
   }
 }
 
diff --git a/src/view/com/modals/LinkActions.tsx b/src/view/com/modals/LinkActions.tsx
index aa185026f..deb1518ec 100644
--- a/src/view/com/modals/LinkActions.tsx
+++ b/src/view/com/modals/LinkActions.tsx
@@ -8,7 +8,15 @@ import {s, colors} from '../../lib/styles'
 
 export const snapPoints = ['30%']
 
-export function Component({title, href}: {title: string; href: string}) {
+export function Component({
+  title,
+  href,
+  newTab,
+}: {
+  title: string
+  href: string
+  newTab: boolean
+}) {
   const store = useStores()
 
   const onPressOpenNewTab = () => {
@@ -28,13 +36,15 @@ export function Component({title, href}: {title: string; href: string}) {
     <View>
       <Text style={[s.textCenter, s.bold, s.mb10, s.f16]}>{title || href}</Text>
       <View style={s.p10}>
-        <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>
+        {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>
diff --git a/src/view/com/modals/TabsSelector.tsx b/src/view/com/modals/TabsSelector.tsx
index 43940bd7c..075da343f 100644
--- a/src/view/com/modals/TabsSelector.tsx
+++ b/src/view/com/modals/TabsSelector.tsx
@@ -23,6 +23,7 @@ import {useStores} from '../../../state'
 import {s, colors, gradients} from '../../lib/styles'
 import {DEF_AVATER} from '../../lib/assets'
 import {match} from '../../routes'
+import {LinkActionsModel} from '../../../state/models/shell'
 
 const TAB_HEIGHT = 42
 
@@ -56,7 +57,13 @@ export const Component = observer(() => {
   }
   const onPressShareTab = () => {
     onClose()
-    // TODO
+    store.shell.openModal(
+      new LinkActionsModel(
+        store.nav.tab.current.url,
+        store.nav.tab.current.title || 'This Page',
+        {newTab: false},
+      ),
+    )
   }
   const onPressChangeTab = (tabIndex: number) => {
     store.nav.setActiveTab(tabIndex)
diff --git a/src/view/com/profile/ProfileHeader.tsx b/src/view/com/profile/ProfileHeader.tsx
index fab26bd57..cb2c61e7c 100644
--- a/src/view/com/profile/ProfileHeader.tsx
+++ b/src/view/com/profile/ProfileHeader.tsx
@@ -86,14 +86,16 @@ export const ProfileHeader = observer(function ProfileHeader({
         <View style={[styles.displayNameLine]}>
           <Text style={styles.displayName}>{view.displayName}</Text>
         </View>
-        <View style={styles.badgesLine}>
+        {
+          undefined /*TODO<View style={styles.badgesLine}>
           <FontAwesomeIcon icon="shield" style={s.mr5} size={12} />
           <Link href="/" title="Badge TODO">
             <Text style={[s.f12, s.bold]}>
               Employee <Text style={[s.blue3]}>@blueskyweb.xyz</Text>
             </Text>
           </Link>
-        </View>
+        </View>*/
+        }
         <View style={[styles.buttonsLine]}>
           {isMe ? (
             <TouchableOpacity
@@ -119,11 +121,13 @@ export const ProfileHeader = observer(function ProfileHeader({
               </LinearGradient>
             </TouchableOpacity>
           )}
-          <TouchableOpacity
+          {
+            undefined /*TODO<TouchableOpacity
             onPress={onPressMenu}
             style={[styles.btn, styles.secondaryBtn, s.ml10]}>
             <FontAwesomeIcon icon="ellipsis" style={[s.gray5]} />
-          </TouchableOpacity>
+          </TouchableOpacity>*/
+          }
         </View>
         <View style={[s.flexRow]}>
           <TouchableOpacity
diff --git a/src/view/screens/ProfileFollowers.tsx b/src/view/screens/ProfileFollowers.tsx
index aabfb59a4..3d78a88a1 100644
--- a/src/view/screens/ProfileFollowers.tsx
+++ b/src/view/screens/ProfileFollowers.tsx
@@ -1,4 +1,5 @@
 import React, {useEffect} from 'react'
+import {StyleSheet, Text, View} from 'react-native'
 import {ProfileFollowers as ProfileFollowersComponent} from '../com/profile/ProfileFollowers'
 import {ScreenParams} from '../routes'
 import {useStores} from '../../state'
@@ -9,9 +10,22 @@ export const ProfileFollowers = ({visible, params}: ScreenParams) => {
 
   useEffect(() => {
     if (visible) {
-      store.nav.setTitle('Followers of')
+      store.nav.setTitle(`Followers of ${name}`)
     }
-  }, [store, visible])
+  }, [store, visible, name])
 
-  return <ProfileFollowersComponent name={name} />
+  return (
+    <View>
+      <Text style={styles.title}>Followers of {name}</Text>
+      <ProfileFollowersComponent name={name} />
+    </View>
+  )
 }
+
+const styles = StyleSheet.create({
+  title: {
+    fontSize: 21,
+    fontWeight: 'bold',
+    padding: 10,
+  },
+})
diff --git a/src/view/screens/ProfileFollows.tsx b/src/view/screens/ProfileFollows.tsx
index d020fc742..6f5c82478 100644
--- a/src/view/screens/ProfileFollows.tsx
+++ b/src/view/screens/ProfileFollows.tsx
@@ -1,4 +1,5 @@
 import React, {useEffect} from 'react'
+import {StyleSheet, Text, View} from 'react-native'
 import {ProfileFollows as ProfileFollowsComponent} from '../com/profile/ProfileFollows'
 import {ScreenParams} from '../routes'
 import {useStores} from '../../state'
@@ -9,9 +10,22 @@ export const ProfileFollows = ({visible, params}: ScreenParams) => {
 
   useEffect(() => {
     if (visible) {
-      store.nav.setTitle('Followers of')
+      store.nav.setTitle(`Followed by ${name}`)
     }
-  }, [store, visible])
+  }, [store, visible, name])
 
-  return <ProfileFollowsComponent name={name} />
+  return (
+    <View>
+      <Text style={styles.title}>Followed by {name}</Text>
+      <ProfileFollowsComponent name={name} />
+    </View>
+  )
 }
+
+const styles = StyleSheet.create({
+  title: {
+    fontSize: 21,
+    fontWeight: 'bold',
+    padding: 10,
+  },
+})