Implement a couple missing bits

zio/stable
Paul Frazee 2022-10-04 10:53:08 -05:00
parent c5ab005908
commit bf39791f01
8 changed files with 81 additions and 24 deletions

View File

@ -331,7 +331,8 @@ function groupNotifications(
for (const item2 of items2) { for (const item2 of items2) {
if ( if (
item.reason === item2.reason && item.reason === item2.reason &&
item.reasonSubject === item2.reasonSubject item.reasonSubject === item2.reasonSubject &&
item.author.did !== item2.author.did
) { ) {
item2.additional = item2.additional || [] item2.additional = item2.additional || []
item2.additional.push(item) item2.additional.push(item)

View File

@ -9,11 +9,20 @@ export class TabsSelectorModel {
} }
} }
export interface LinkActionsModelOpts {
newTab?: boolean
}
export class LinkActionsModel { export class LinkActionsModel {
name = 'link-actions' name = 'link-actions'
newTab: boolean
constructor(public href: string, public title: string) { constructor(
public href: string,
public title: string,
opts?: LinkActionsModelOpts,
) {
makeAutoObservable(this) makeAutoObservable(this)
this.newTab = typeof opts?.newTab === 'boolean' ? opts.newTab : true
} }
} }

View File

@ -8,7 +8,15 @@ import {s, colors} from '../../lib/styles'
export const snapPoints = ['30%'] 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 store = useStores()
const onPressOpenNewTab = () => { const onPressOpenNewTab = () => {
@ -28,6 +36,7 @@ export function Component({title, href}: {title: string; href: string}) {
<View> <View>
<Text style={[s.textCenter, s.bold, s.mb10, s.f16]}>{title || href}</Text> <Text style={[s.textCenter, s.bold, s.mb10, s.f16]}>{title || href}</Text>
<View style={s.p10}> <View style={s.p10}>
{newTab ? (
<TouchableOpacity onPress={onPressOpenNewTab} style={styles.btn}> <TouchableOpacity onPress={onPressOpenNewTab} style={styles.btn}>
<FontAwesomeIcon <FontAwesomeIcon
icon="arrow-up-right-from-square" icon="arrow-up-right-from-square"
@ -35,6 +44,7 @@ export function Component({title, href}: {title: string; href: string}) {
/> />
<Text style={[s.f16, s.black]}>Open in new tab</Text> <Text style={[s.f16, s.black]}>Open in new tab</Text>
</TouchableOpacity> </TouchableOpacity>
) : undefined}
<TouchableOpacity onPress={onPressCopy} style={styles.btn}> <TouchableOpacity onPress={onPressCopy} style={styles.btn}>
<FontAwesomeIcon icon="link" style={styles.icon} /> <FontAwesomeIcon icon="link" style={styles.icon} />
<Text style={[s.f16, s.black]}>Copy to clipboard</Text> <Text style={[s.f16, s.black]}>Copy to clipboard</Text>

View File

@ -23,6 +23,7 @@ import {useStores} from '../../../state'
import {s, colors, gradients} from '../../lib/styles' import {s, colors, gradients} from '../../lib/styles'
import {DEF_AVATER} from '../../lib/assets' import {DEF_AVATER} from '../../lib/assets'
import {match} from '../../routes' import {match} from '../../routes'
import {LinkActionsModel} from '../../../state/models/shell'
const TAB_HEIGHT = 42 const TAB_HEIGHT = 42
@ -56,7 +57,13 @@ export const Component = observer(() => {
} }
const onPressShareTab = () => { const onPressShareTab = () => {
onClose() 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) => { const onPressChangeTab = (tabIndex: number) => {
store.nav.setActiveTab(tabIndex) store.nav.setActiveTab(tabIndex)

View File

@ -86,14 +86,16 @@ export const ProfileHeader = observer(function ProfileHeader({
<View style={[styles.displayNameLine]}> <View style={[styles.displayNameLine]}>
<Text style={styles.displayName}>{view.displayName}</Text> <Text style={styles.displayName}>{view.displayName}</Text>
</View> </View>
<View style={styles.badgesLine}> {
undefined /*TODO<View style={styles.badgesLine}>
<FontAwesomeIcon icon="shield" style={s.mr5} size={12} /> <FontAwesomeIcon icon="shield" style={s.mr5} size={12} />
<Link href="/" title="Badge TODO"> <Link href="/" title="Badge TODO">
<Text style={[s.f12, s.bold]}> <Text style={[s.f12, s.bold]}>
Employee <Text style={[s.blue3]}>@blueskyweb.xyz</Text> Employee <Text style={[s.blue3]}>@blueskyweb.xyz</Text>
</Text> </Text>
</Link> </Link>
</View> </View>*/
}
<View style={[styles.buttonsLine]}> <View style={[styles.buttonsLine]}>
{isMe ? ( {isMe ? (
<TouchableOpacity <TouchableOpacity
@ -119,11 +121,13 @@ export const ProfileHeader = observer(function ProfileHeader({
</LinearGradient> </LinearGradient>
</TouchableOpacity> </TouchableOpacity>
)} )}
<TouchableOpacity {
undefined /*TODO<TouchableOpacity
onPress={onPressMenu} onPress={onPressMenu}
style={[styles.btn, styles.secondaryBtn, s.ml10]}> style={[styles.btn, styles.secondaryBtn, s.ml10]}>
<FontAwesomeIcon icon="ellipsis" style={[s.gray5]} /> <FontAwesomeIcon icon="ellipsis" style={[s.gray5]} />
</TouchableOpacity> </TouchableOpacity>*/
}
</View> </View>
<View style={[s.flexRow]}> <View style={[s.flexRow]}>
<TouchableOpacity <TouchableOpacity

View File

@ -1,4 +1,5 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {StyleSheet, Text, View} from 'react-native'
import {ProfileFollowers as ProfileFollowersComponent} from '../com/profile/ProfileFollowers' import {ProfileFollowers as ProfileFollowersComponent} from '../com/profile/ProfileFollowers'
import {ScreenParams} from '../routes' import {ScreenParams} from '../routes'
import {useStores} from '../../state' import {useStores} from '../../state'
@ -9,9 +10,22 @@ export const ProfileFollowers = ({visible, params}: ScreenParams) => {
useEffect(() => { useEffect(() => {
if (visible) { 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,
},
})

View File

@ -1,4 +1,5 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {StyleSheet, Text, View} from 'react-native'
import {ProfileFollows as ProfileFollowsComponent} from '../com/profile/ProfileFollows' import {ProfileFollows as ProfileFollowsComponent} from '../com/profile/ProfileFollows'
import {ScreenParams} from '../routes' import {ScreenParams} from '../routes'
import {useStores} from '../../state' import {useStores} from '../../state'
@ -9,9 +10,22 @@ export const ProfileFollows = ({visible, params}: ScreenParams) => {
useEffect(() => { useEffect(() => {
if (visible) { 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,
},
})

View File

@ -2,7 +2,6 @@ Paul's todo list
- General - General
- Update to RN 0.70 - Update to RN 0.70
- Go through every button and make sure it does what it's supposed to
- Cache some profile/userinfo lookups - Cache some profile/userinfo lookups
- Cursor behaviors on all views - Cursor behaviors on all views
- Onboarding flow - Onboarding flow
@ -12,9 +11,8 @@ Paul's todo list
- Firehose - Firehose
- Composer - Composer
- Update the view after creating a post - Update the view after creating a post
- Mentions
- Profile - Profile
- Disable badges for now - Implement update/edit
- Disable editing avi or banner - Disable editing avi or banner
- More button - More button
- Linking - Linking