From bf39791f011f19c6ff192eb223e15259dc9de53a Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 4 Oct 2022 10:53:08 -0500 Subject: [PATCH] Implement a couple missing bits --- src/state/models/notifications-view.ts | 3 ++- src/state/models/shell.ts | 11 ++++++++++- src/view/com/modals/LinkActions.tsx | 26 ++++++++++++++++++-------- src/view/com/modals/TabsSelector.tsx | 9 ++++++++- src/view/com/profile/ProfileHeader.tsx | 12 ++++++++---- src/view/screens/ProfileFollowers.tsx | 20 +++++++++++++++++--- src/view/screens/ProfileFollows.tsx | 20 +++++++++++++++++--- todos.txt | 4 +--- 8 files changed, 81 insertions(+), 24 deletions(-) diff --git a/src/state/models/notifications-view.ts b/src/state/models/notifications-view.ts index 620f0ffa..5528b9f0 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 80ecbdd4..3a537642 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 aa185026..deb1518e 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}) { {title || href} - - - Open in new tab - + {newTab ? ( + + + Open in new tab + + ) : undefined} Copy to clipboard diff --git a/src/view/com/modals/TabsSelector.tsx b/src/view/com/modals/TabsSelector.tsx index 43940bd7..075da343 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 fab26bd5..cb2c61e7 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.displayName} - + { + undefined /*TODO Employee @blueskyweb.xyz - + */ + } {isMe ? ( )} - - + */ + } { useEffect(() => { if (visible) { - store.nav.setTitle('Followers of') + store.nav.setTitle(`Followers of ${name}`) } - }, [store, visible]) + }, [store, visible, name]) - return + return ( + + Followers of {name} + + + ) } + +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 d020fc74..6f5c8247 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 + return ( + + Followed by {name} + + + ) } + +const styles = StyleSheet.create({ + title: { + fontSize: 21, + fontWeight: 'bold', + padding: 10, + }, +}) diff --git a/todos.txt b/todos.txt index a9dcf99d..171be4d5 100644 --- a/todos.txt +++ b/todos.txt @@ -2,7 +2,6 @@ Paul's todo list - General - Update to RN 0.70 - - Go through every button and make sure it does what it's supposed to - Cache some profile/userinfo lookups - Cursor behaviors on all views - Onboarding flow @@ -12,9 +11,8 @@ Paul's todo list - Firehose - Composer - Update the view after creating a post - - Mentions - Profile - - Disable badges for now + - Implement update/edit - Disable editing avi or banner - More button - Linking