diff options
Diffstat (limited to 'src/view')
-rw-r--r-- | src/view/com/modals/ComposePost.tsx | 4 | ||||
-rw-r--r-- | src/view/com/notifications/FeedItem.tsx | 6 | ||||
-rw-r--r-- | src/view/com/post-thread/PostLikedBy.tsx | 2 | ||||
-rw-r--r-- | src/view/com/post-thread/PostRepostedBy.tsx | 2 | ||||
-rw-r--r-- | src/view/com/post-thread/PostThreadItem.tsx | 20 | ||||
-rw-r--r-- | src/view/com/post/Post.tsx | 22 | ||||
-rw-r--r-- | src/view/com/posts/Feed.tsx | 2 | ||||
-rw-r--r-- | src/view/com/posts/FeedItem.tsx | 20 | ||||
-rw-r--r-- | src/view/com/profile/ProfileFollowers.tsx | 2 | ||||
-rw-r--r-- | src/view/com/profile/ProfileFollows.tsx | 2 | ||||
-rw-r--r-- | src/view/com/profile/ProfileHeader.tsx | 5 | ||||
-rw-r--r-- | src/view/lib/assets.native.ts | 6 | ||||
-rw-r--r-- | src/view/lib/assets.ts | 6 | ||||
-rw-r--r-- | src/view/lib/strings.ts | 2 | ||||
-rw-r--r-- | src/view/screens/Profile.tsx | 2 | ||||
-rw-r--r-- | src/view/shell/mobile/accounts-menu.tsx | 2 | ||||
-rw-r--r-- | src/view/shell/mobile/index.tsx | 4 |
17 files changed, 54 insertions, 55 deletions
diff --git a/src/view/com/modals/ComposePost.tsx b/src/view/com/modals/ComposePost.tsx index b55143098..cdd312352 100644 --- a/src/view/com/modals/ComposePost.tsx +++ b/src/view/com/modals/ComposePost.tsx @@ -15,7 +15,7 @@ const WARNING_TEXT_LENGTH = 200 const DANGER_TEXT_LENGTH = 255 export const snapPoints = ['100%'] -const DEBUG_USERNAMES = ['alice.com', 'bob.com', 'carla.com'] +const DEBUG_USERNAMES = ['alice.test', 'bob.test', 'carol.test'] export function Component({replyTo}: {replyTo?: string}) { const store = useStores() @@ -48,7 +48,7 @@ export function Component({replyTo}: {replyTo?: string}) { return false } try { - await apilib.post(store.api, 'alice.com', text, replyTo) + await apilib.post(store.api, 'alice.test', text, replyTo) } catch (e: any) { console.error(`Failed to create post: ${e.toString()}`) setError( diff --git a/src/view/com/notifications/FeedItem.tsx b/src/view/com/notifications/FeedItem.tsx index 931337926..795c13dfb 100644 --- a/src/view/com/notifications/FeedItem.tsx +++ b/src/view/com/notifications/FeedItem.tsx @@ -1,7 +1,7 @@ import React, {useMemo} from 'react' import {observer} from 'mobx-react-lite' -import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native' -import {AdxUri} from '@adxp/mock-api' +import {Image, StyleSheet, Text, View} from 'react-native' +import {AdxUri} from '../../../third-party/uri' import {FontAwesomeIcon, Props} from '@fortawesome/react-native-fontawesome' import {NotificationsViewItemModel} from '../../../state/models/notifications-view' import {s, colors} from '../../lib/styles' @@ -64,7 +64,7 @@ export const FeedItem = observer(function FeedItem({ <Link style={styles.layoutAvi} href={authorHref} title={authorTitle}> <Image style={styles.avi} - source={AVIS[item.author.name] || AVIS['alice.com']} + source={AVIS[item.author.name] || AVIS['alice.test']} /> </Link> <View style={styles.layoutContent}> diff --git a/src/view/com/post-thread/PostLikedBy.tsx b/src/view/com/post-thread/PostLikedBy.tsx index e928f3591..bfaa52137 100644 --- a/src/view/com/post-thread/PostLikedBy.tsx +++ b/src/view/com/post-thread/PostLikedBy.tsx @@ -80,7 +80,7 @@ const LikedByItem = ({item}: {item: LikedByViewItemModel}) => { <View style={styles.layoutAvi}> <Image style={styles.avi} - source={AVIS[item.name] || AVIS['alice.com']} + source={AVIS[item.name] || AVIS['alice.test']} /> </View> <View style={styles.layoutContent}> diff --git a/src/view/com/post-thread/PostRepostedBy.tsx b/src/view/com/post-thread/PostRepostedBy.tsx index 1c4e42a8e..1da76da54 100644 --- a/src/view/com/post-thread/PostRepostedBy.tsx +++ b/src/view/com/post-thread/PostRepostedBy.tsx @@ -86,7 +86,7 @@ const RepostedByItem = ({item}: {item: RepostedByViewItemModel}) => { <View style={styles.layoutAvi}> <Image style={styles.avi} - source={AVIS[item.name] || AVIS['alice.com']} + source={AVIS[item.name] || AVIS['alice.test']} /> </View> <View style={styles.layoutContent}> diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index a55accdc3..ebc81d887 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -1,7 +1,8 @@ import React, {useMemo} from 'react' import {observer} from 'mobx-react-lite' import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native' -import {bsky, AdxUri} from '@adxp/mock-api' +import {AdxUri} from '../../../third-party/uri' +import * as PostType from '../../../third-party/api/src/types/todo/social/post' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {PostThreadViewPostModel} from '../../../state/models/post-thread-view' import {ComposePostModel} from '../../../state/models/shell' @@ -20,7 +21,7 @@ export const PostThreadItem = observer(function PostThreadItem({ onPressShare: (_uri: string) => void }) { const store = useStores() - const record = item.record as unknown as bsky.Post.Record + const record = item.record as unknown as PostType.Record const hasEngagement = item.likeCount || item.repostCount const itemHref = useMemo(() => { @@ -68,23 +69,22 @@ export const PostThreadItem = observer(function PostThreadItem({ <TouchableOpacity style={styles.ctrl} onPress={onPressToggleRepost}> <FontAwesomeIcon style={ - item.myState.hasReposted ? styles.ctrlIconReposted : styles.ctrlIcon + item.myState.repost ? styles.ctrlIconReposted : styles.ctrlIcon } icon="retweet" size={18} /> - <Text - style={item.myState.hasReposted ? [s.bold, s.green3, s.f13] : s.f13}> + <Text style={item.myState.repost ? [s.bold, s.green3, s.f13] : s.f13}> {item.repostCount} </Text> </TouchableOpacity> <TouchableOpacity style={styles.ctrl} onPress={onPressToggleLike}> <FontAwesomeIcon - style={item.myState.hasLiked ? styles.ctrlIconLiked : styles.ctrlIcon} - icon={[item.myState.hasLiked ? 'fas' : 'far', 'heart']} + style={item.myState.like ? styles.ctrlIconLiked : styles.ctrlIcon} + icon={[item.myState.like ? 'fas' : 'far', 'heart']} size={14} /> - <Text style={item.myState.hasLiked ? [s.bold, s.red3, s.f13] : s.f13}> + <Text style={item.myState.like ? [s.bold, s.red3, s.f13] : s.f13}> {item.likeCount} </Text> </TouchableOpacity> @@ -107,7 +107,7 @@ export const PostThreadItem = observer(function PostThreadItem({ <Link style={styles.layoutAvi} href={authorHref} title={authorTitle}> <Image style={styles.avi} - source={AVIS[item.author.name] || AVIS['alice.com']} + source={AVIS[item.author.name] || AVIS['alice.test']} /> </Link> <View style={styles.layoutContent}> @@ -192,7 +192,7 @@ export const PostThreadItem = observer(function PostThreadItem({ <Link style={styles.layoutAvi} href={authorHref} title={authorTitle}> <Image style={styles.avi} - source={AVIS[item.author.name] || AVIS['alice.com']} + source={AVIS[item.author.name] || AVIS['alice.test']} /> </Link> <View style={styles.layoutContent}> diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx index 7ccbbcf36..2a9cb71fc 100644 --- a/src/view/com/post/Post.tsx +++ b/src/view/com/post/Post.tsx @@ -1,6 +1,7 @@ -import React, {useState, useEffect} from 'react' +import React, {useState, useEffect, useMemo} from 'react' import {observer} from 'mobx-react-lite' -import {bsky, AdxUri} from '@adxp/mock-api' +import {AdxUri} from '../../../third-party/uri' +import * as PostType from '../../../third-party/api/src/types/todo/social/post' import { ActivityIndicator, Image, @@ -54,7 +55,7 @@ export const Post = observer(function Post({uri}: {uri: string}) { // loaded // = const item = view.thread - const record = view.thread?.record as unknown as bsky.Post.Record + const record = view.thread?.record as unknown as PostType.Record const itemHref = useMemo(() => { const urip = new AdxUri(item.uri) @@ -83,7 +84,7 @@ export const Post = observer(function Post({uri}: {uri: string}) { <Link style={styles.layoutAvi} href={authorHref} title={authorTitle}> <Image style={styles.avi} - source={AVIS[item.author.name] || AVIS['alice.com']} + source={AVIS[item.author.name] || AVIS['alice.test']} /> </Link> <View style={styles.layoutContent}> @@ -112,7 +113,7 @@ export const Post = observer(function Post({uri}: {uri: string}) { <TouchableOpacity style={styles.ctrl} onPress={onPressToggleRepost}> <FontAwesomeIcon style={ - item.myState.hasReposted + item.myState.repost ? styles.ctrlIconReposted : styles.ctrlIcon } @@ -120,21 +121,18 @@ export const Post = observer(function Post({uri}: {uri: string}) { size={22} /> <Text - style={ - item.myState.hasReposted ? [s.bold, s.green3] : undefined - }> + style={item.myState.repost ? [s.bold, s.green3] : undefined}> {item.repostCount} </Text> </TouchableOpacity> <TouchableOpacity style={styles.ctrl} onPress={onPressToggleLike}> <FontAwesomeIcon style={ - item.myState.hasLiked ? styles.ctrlIconLiked : styles.ctrlIcon + item.myState.like ? styles.ctrlIconLiked : styles.ctrlIcon } - icon={[item.myState.hasLiked ? 'fas' : 'far', 'heart']} + icon={[item.myState.like ? 'fas' : 'far', 'heart']} /> - <Text - style={item.myState.hasLiked ? [s.bold, s.red3] : undefined}> + <Text style={item.myState.like ? [s.bold, s.red3] : undefined}> {item.likeCount} </Text> </TouchableOpacity> diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx index 370a72e69..8c14b0810 100644 --- a/src/view/com/posts/Feed.tsx +++ b/src/view/com/posts/Feed.tsx @@ -26,7 +26,7 @@ export const Feed = observer(function Feed({feed}: {feed: FeedViewModel}) { {feed.isLoading && !feed.isRefreshing && !feed.hasContent && ( <Text>Loading...</Text> )} - {feed.hasError && <Text>{feed.error}</Text>} + {feed.hasError && <Text>{feed.errorStr}</Text>} {feed.hasContent && ( <FlatList data={feed.feed.slice()} diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index b8ab1e4ba..31554839f 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -1,7 +1,8 @@ import React, {useMemo} from 'react' import {observer} from 'mobx-react-lite' import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native' -import {bsky, AdxUri} from '@adxp/mock-api' +import {AdxUri} from '../../../third-party/uri' +import * as PostType from '../../../third-party/api/src/types/todo/social/post' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FeedViewItemModel} from '../../../state/models/feed-view' import {ComposePostModel, SharePostModel} from '../../../state/models/shell' @@ -18,7 +19,7 @@ export const FeedItem = observer(function FeedItem({ item: FeedViewItemModel }) { const store = useStores() - const record = item.record as unknown as bsky.Post.Record + const record = item.record as unknown as PostType.Record const itemHref = useMemo(() => { const urip = new AdxUri(item.uri) return `/profile/${item.author.name}/post/${urip.recordKey}` @@ -60,7 +61,7 @@ export const FeedItem = observer(function FeedItem({ title={item.author.name}> <Image style={styles.avi} - source={AVIS[item.author.name] || AVIS['alice.com']} + source={AVIS[item.author.name] || AVIS['alice.test']} /> </Link> <View style={styles.layoutContent}> @@ -107,7 +108,7 @@ export const FeedItem = observer(function FeedItem({ <TouchableOpacity style={styles.ctrl} onPress={onPressToggleRepost}> <FontAwesomeIcon style={ - item.myState.hasReposted + item.myState.repost ? styles.ctrlIconReposted : styles.ctrlIcon } @@ -115,22 +116,19 @@ export const FeedItem = observer(function FeedItem({ size={18} /> <Text - style={ - item.myState.hasReposted ? [s.bold, s.green3, s.f13] : s.f13 - }> + style={item.myState.repost ? [s.bold, s.green3, s.f13] : s.f13}> {item.repostCount} </Text> </TouchableOpacity> <TouchableOpacity style={styles.ctrl} onPress={onPressToggleLike}> <FontAwesomeIcon style={ - item.myState.hasLiked ? styles.ctrlIconLiked : styles.ctrlIcon + item.myState.like ? styles.ctrlIconLiked : styles.ctrlIcon } - icon={[item.myState.hasLiked ? 'fas' : 'far', 'heart']} + icon={[item.myState.like ? 'fas' : 'far', 'heart']} size={14} /> - <Text - style={item.myState.hasLiked ? [s.bold, s.red3, s.f13] : s.f13}> + <Text style={item.myState.like ? [s.bold, s.red3, s.f13] : s.f13}> {item.likeCount} </Text> </TouchableOpacity> diff --git a/src/view/com/profile/ProfileFollowers.tsx b/src/view/com/profile/ProfileFollowers.tsx index 20a2ab913..e6ad30d7f 100644 --- a/src/view/com/profile/ProfileFollowers.tsx +++ b/src/view/com/profile/ProfileFollowers.tsx @@ -83,7 +83,7 @@ const User = ({item}: {item: FollowerItem}) => { <View style={styles.layoutAvi}> <Image style={styles.avi} - source={AVIS[item.name] || AVIS['alice.com']} + source={AVIS[item.name] || AVIS['alice.test']} /> </View> <View style={styles.layoutContent}> diff --git a/src/view/com/profile/ProfileFollows.tsx b/src/view/com/profile/ProfileFollows.tsx index 6517c4596..83ada4b77 100644 --- a/src/view/com/profile/ProfileFollows.tsx +++ b/src/view/com/profile/ProfileFollows.tsx @@ -84,7 +84,7 @@ const User = ({item}: {item: FollowItem}) => { <View style={styles.layoutAvi}> <Image style={styles.avi} - source={AVIS[item.name] || AVIS['alice.com']} + source={AVIS[item.name] || AVIS['alice.test']} /> </View> <View style={styles.layoutContent}> diff --git a/src/view/com/profile/ProfileHeader.tsx b/src/view/com/profile/ProfileHeader.tsx index 5ac161265..c5984ddff 100644 --- a/src/view/com/profile/ProfileHeader.tsx +++ b/src/view/com/profile/ProfileHeader.tsx @@ -81,7 +81,10 @@ export const ProfileHeader = observer(function ProfileHeader({ return ( <View style={styles.outer}> <Image style={styles.banner} source={BANNER} /> - <Image style={styles.avi} source={AVIS[view.name] || AVIS['alice.com']} /> + <Image + style={styles.avi} + source={AVIS[view.name] || AVIS['alice.test']} + /> <View style={styles.content}> <View style={[styles.displayNameLine]}> <Text style={styles.displayName}>{view.displayName}</Text> diff --git a/src/view/lib/assets.native.ts b/src/view/lib/assets.native.ts index a341e02a9..e0e027ad7 100644 --- a/src/view/lib/assets.native.ts +++ b/src/view/lib/assets.native.ts @@ -1,9 +1,9 @@ import {ImageSourcePropType} from 'react-native' export const AVIS: Record<string, ImageSourcePropType> = { - 'alice.com': require('../../../public/img/alice.jpg'), - 'bob.com': require('../../../public/img/bob.jpg'), - 'carla.com': require('../../../public/img/carla.jpg'), + 'alice.test': require('../../../public/img/alice.jpg'), + 'bob.test': require('../../../public/img/bob.jpg'), + 'carol.test': require('../../../public/img/carla.jpg'), } export const BANNER: ImageSourcePropType = require('../../../public/img/banner.jpg') diff --git a/src/view/lib/assets.ts b/src/view/lib/assets.ts index 1575101d2..957348eca 100644 --- a/src/view/lib/assets.ts +++ b/src/view/lib/assets.ts @@ -1,9 +1,9 @@ import {ImageSourcePropType} from 'react-native' export const AVIS: Record<string, ImageSourcePropType> = { - 'alice.com': {uri: '/img/alice.jpg'}, - 'bob.com': {uri: '/img/bob.jpg'}, - 'carla.com': {uri: '/img/carla.jpg'}, + 'alice.test': {uri: '/img/alice.jpg'}, + 'bob.test': {uri: '/img/bob.jpg'}, + 'carol.test': {uri: '/img/carla.jpg'}, } export const BANNER: ImageSourcePropType = {uri: '/img/banner.jpg'} diff --git a/src/view/lib/strings.ts b/src/view/lib/strings.ts index 30426e674..d468a18ac 100644 --- a/src/view/lib/strings.ts +++ b/src/view/lib/strings.ts @@ -1,4 +1,4 @@ -import {AdxUri} from '@adxp/mock-api' +import {AdxUri} from '../../third-party/uri' export function pluralize(n: number, base: string, plural?: string): string { if (n === 1) { diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 9fe094af1..422e561df 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -80,7 +80,7 @@ export const Profile = observer(({visible, params}: ScreenParams) => { } else if (profileUiState.feed.hasError) { items.push({ _reactKey: '__error__', - error: profileUiState.feed.error, + error: profileUiState.feed.errorStr, }) renderItem = (item: any) => ( <View style={s.p5}> diff --git a/src/view/shell/mobile/accounts-menu.tsx b/src/view/shell/mobile/accounts-menu.tsx index 24b614cec..fb8b9682b 100644 --- a/src/view/shell/mobile/accounts-menu.tsx +++ b/src/view/shell/mobile/accounts-menu.tsx @@ -32,7 +32,7 @@ export function createAccountsMenu({ <TouchableOpacity style={[styles.menuItem]} onPress={() => onPressItem(0)}> - <Image style={styles.avi} source={AVIS['alice.com']} /> + <Image style={styles.avi} source={AVIS['alice.test']} /> <Text style={[styles.label, s.bold]}>Alice</Text> </TouchableOpacity> <TouchableOpacity diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx index 2a981e100..5896d7008 100644 --- a/src/view/shell/mobile/index.tsx +++ b/src/view/shell/mobile/index.tsx @@ -113,7 +113,7 @@ export const MobileShell: React.FC = observer(() => { const onPressAvi = () => createAccountsMenu({ - debug_onPressItem: () => store.nav.navigate('/profile/alice.com'), + debug_onPressItem: () => store.nav.navigate('/profile/alice.test'), }) const onPressLocation = () => setLocationMenuActive(true) const onPressEllipsis = () => createLocationMenu() @@ -168,7 +168,7 @@ export const MobileShell: React.FC = observer(() => { <View style={styles.outerContainer}> <View style={styles.topBar}> <TouchableOpacity onPress={onPressAvi}> - <Image style={styles.avi} source={AVIS['alice.com']} /> + <Image style={styles.avi} source={AVIS['alice.test']} /> </TouchableOpacity> <Location icon={screenRenderDesc.icon} |