Skip to content

Commit 837e466

Browse files
committed
Ability to reply to a post, and show the parent post on the reply
1 parent 857663b commit 837e466

34 files changed

Lines changed: 718 additions & 1141 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { default } from '@/src/features/composer/ComposeSheetRoute';
1+
export { default } from '@/src/features/composer/ComposeScreen';

apps/polycentric/src/common/components/composites/IdentityBadge.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,30 @@ import {
22
Text,
33
Avatar,
44
type AvatarSizePreset,
5-
PubkeyTag,
5+
IdentityTag,
66
type TextVariant,
77
} from '@/src/common/components/primitives';
88
import { useUsername, identiconUrl } from '@/src/common/lib/polycentric-hooks';
9-
import { types } from '@polycentric/react-native';
109
import { Atoms, type SpacingToken } from '@/src/common/theme';
1110
import { View } from 'react-native';
1211

1312
type BadgeSize = 'md' | 'lg';
1413

1514
interface IdentityBadgeProps {
16-
publicKey: types.PublicKey;
15+
identityKey: string;
1716
size?: BadgeSize;
1817
showAvatar?: boolean;
1918
showId?: boolean;
2019
}
2120

2221
export function IdentityBadge({
23-
publicKey,
22+
identityKey,
2423
size = 'md',
2524
showAvatar = true,
2625
showId = true,
2726
}: IdentityBadgeProps) {
28-
const username = useUsername(publicKey);
29-
const avatarUrl = identiconUrl(publicKey);
27+
const username = useUsername(identityKey);
28+
const avatarUrl = identiconUrl(identityKey);
3029

3130
const sizeConfig = CONFIG[size];
3231
const rowGap = size === 'lg' ? Atoms.gap_md : Atoms.gap_sm;
@@ -54,7 +53,7 @@ export function IdentityBadge({
5453
>
5554
{username}
5655
</Text>
57-
{showId && <PubkeyTag publicKey={publicKey} />}
56+
{showId && <IdentityTag identity={identityKey} />}
5857
</View>
5958
</View>
6059
);
Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,21 @@
11
import { type ComponentProps } from 'react';
22
import { Text } from './Text';
3-
import {
4-
getIdentityIdShort,
5-
shortenIdentityId,
6-
} from '@/src/common/lib/polycentric-hooks';
7-
import { types } from '@polycentric/react-native';
3+
import { shortenIdentityId } from '@/src/common/lib/polycentric-hooks';
84

9-
interface PubkeyTagProps {
10-
publicKey: types.PublicKey;
11-
/**
12-
* v2 identity id (hex sha256 of the initial Identity content). When
13-
* provided, the tag renders a short form of this identity instead of the
14-
* signer's public key — this is what users should actually see.
15-
*/
16-
identity?: string;
5+
interface IdentityTagProps {
6+
/** v2 identity id (hex sha256 of the initial Identity content). */
7+
identity: string | undefined;
178
style?: ComponentProps<typeof Text>['style'];
189
}
1910

20-
export function PubkeyTag({ publicKey, identity, style }: PubkeyTagProps) {
21-
const label = identity
22-
? shortenIdentityId(identity)
23-
: getIdentityIdShort(publicKey);
24-
11+
export function IdentityTag({ identity, style }: IdentityTagProps) {
2512
return (
2613
<Text
2714
variant="secondary"
2815
color="neutral_500"
2916
style={[{ fontFamily: 'monospace' }, style]}
3017
>
31-
{label}
18+
{shortenIdentityId(identity)}
3219
</Text>
3320
);
3421
}

apps/polycentric/src/common/constants/routes.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { router } from 'expo-router';
22

3-
export function openCompose(replyToPostId?: string) {
4-
if (replyToPostId) {
5-
router.push(
6-
`${Routes.tabs.feed.compose}?replyTo=${encodeURIComponent(replyToPostId)}`,
7-
);
3+
export function openCompose(replyTo?: {
4+
identityId: string;
5+
sequence: string;
6+
}) {
7+
if (replyTo) {
8+
const path = `${encodeURIComponent(replyTo.identityId)}/${encodeURIComponent(replyTo.sequence)}`;
9+
router.push(`${Routes.tabs.feed.compose}?replyTo=${path}`);
810
} else {
911
router.push(Routes.tabs.feed.compose);
1012
}

0 commit comments

Comments
 (0)