Skip to content

Commit caf232b

Browse files
Merge upstream develop
2 parents 193c189 + 623f5f6 commit caf232b

26 files changed

Lines changed: 506 additions & 236 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '@/src/features/profile/EditProfileScreen';

apps/polycentric/app/_layout.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ function RootStack() {
4343
contentStyle: { backgroundColor: 'transparent' },
4444
}}
4545
/>
46+
<Stack.Screen
47+
name="[identityId]/edit"
48+
options={{
49+
presentation: 'transparentModal',
50+
animation: 'none',
51+
contentStyle: { backgroundColor: 'transparent' },
52+
}}
53+
/>
4654
</Stack>
4755
);
4856

apps/polycentric/src/common/components/layout/Layout.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,19 @@ export const LeftSidebar = memo(function LeftSidebar({
198198
<VerticalNav />
199199
</View>
200200
{/* 2nd Section (bottom) */}
201-
<View style={[Atoms.py_md, Atoms.self_stretch]}>
201+
<View
202+
style={[
203+
Atoms.py_md,
204+
Atoms.self_stretch,
205+
narrowSidebar && Atoms.align_center,
206+
]}
207+
>
202208
{identity && (
203209
<Button
204-
title="New Post"
210+
title={narrowSidebar ? '' : 'New Post'}
205211
variant="primary"
206212
size="md"
207-
fullWidth
213+
fullWidth={!narrowSidebar}
208214
icon={({ size, color }) => (
209215
<Ionicons name="add-circle" size={size} color={color} />
210216
)}

apps/polycentric/src/common/components/primitives/Button.tsx

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useWebHover } from '@/src/common/lib/useWebHover';
33
import {
44
Atoms,
55
BorderRadius,
6+
Spacing,
67
useTheme,
78
withHexOpacity,
89
type BorderRadiusToken,
@@ -52,8 +53,18 @@ const SIZE_CONFIG: Record<
5253
borderRadius: BorderRadiusToken;
5354
}
5455
> = {
55-
sm: { paddingV: 4, paddingH: 6, iconSize: 16, borderRadius: 'full' },
56-
md: { paddingV: 12, paddingH: 18, iconSize: 20, borderRadius: 'full' },
56+
sm: {
57+
paddingV: 4,
58+
paddingH: Spacing['lg'],
59+
iconSize: 16,
60+
borderRadius: 'full',
61+
},
62+
md: {
63+
paddingV: 12,
64+
paddingH: Spacing['xl'],
65+
iconSize: 20,
66+
borderRadius: 'full',
67+
},
5768
lg: { paddingV: 18, paddingH: 24, iconSize: 24, borderRadius: 'full' },
5869
};
5970

@@ -74,6 +85,10 @@ export function Button({
7485

7586
const sizeConfig = SIZE_CONFIG[size];
7687
const borderRadius = BorderRadius[sizeConfig.borderRadius];
88+
const iconOnly = !!icon && !title;
89+
const paddingHorizontal = iconOnly
90+
? sizeConfig.paddingV
91+
: sizeConfig.paddingH;
7792
const isDisabled = !!disabled;
7893
const iconColor = isDisabled
7994
? withHexOpacity(theme.palette.neutral_500, '80')
@@ -100,7 +115,7 @@ export function Button({
100115
!fullWidth && styles.fitContent,
101116
{
102117
paddingVertical: sizeConfig.paddingV,
103-
paddingHorizontal: sizeConfig.paddingH,
118+
paddingHorizontal,
104119
borderRadius,
105120
},
106121
surfaceStyle,
@@ -109,24 +124,27 @@ export function Button({
109124
]}
110125
{...props}
111126
>
112-
<View style={[styles.content, icon && title && { marginLeft: -3 }]}>
127+
<View style={[styles.content]}>
113128
{icon &&
114129
icon({
115130
size: sizeConfig.iconSize,
116131
color: iconColor,
117132
})}
118-
<Text
119-
fontWeight={FONT_WEIGHT}
120-
color={isDisabled ? 'neutral_1000' : textColorMap[variant]}
121-
style={
122-
isDisabled
123-
? { color: withHexOpacity(theme.palette.neutral_500, '80') }
124-
: undefined
125-
}
126-
numberOfLines={1}
127-
>
128-
{title}
129-
</Text>
133+
{!iconOnly && (
134+
<Text
135+
fontSize={size}
136+
fontWeight={FONT_WEIGHT}
137+
color={isDisabled ? 'neutral_1000' : textColorMap[variant]}
138+
style={
139+
isDisabled
140+
? { color: withHexOpacity(theme.palette.neutral_500, '80') }
141+
: undefined
142+
}
143+
numberOfLines={1}
144+
>
145+
{title}
146+
</Text>
147+
)}
130148
</View>
131149
</Pressable>
132150
</Animated.View>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const Routes = {
2222
search: '/search',
2323
claims: '/claims',
2424
profile: (identityId: string) => `/${identityId}` as const,
25+
editProfile: (identityId: string) => `/${identityId}/edit` as const,
2526
post: (identityId: string, postId: string) =>
2627
`/${identityId}/post/${postId}` as const,
2728
settings: {

apps/polycentric/src/common/lib/polycentric-hooks/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export {
2525
useProfileScreenData,
2626
type ProfileScreenData,
2727
} from './useProfileScreenData';
28-
export { useProfileEdit, type ProfileEditState } from './useProfileEdit';
28+
export {
29+
useProfileEdit,
30+
type ProfileEditState,
31+
} from '../../../features/profile/hooks/useProfileEdit';
2932

3033
// Helpers
3134
export {

apps/polycentric/src/common/lib/polycentric-hooks/useProfileScreenData.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ export function useProfileScreenData(
3838

3939
const identityKey = identityIdParam ?? null;
4040

41-
const username = useUsername(identityKey);
42-
const profile = useProfile(identityKey, { getIsAborted });
41+
const fallbackUsername = useUsername(identityKey);
42+
const profile = useProfile(identityKey);
43+
const username = profile.name ?? fallbackUsername;
4344
const authorFeed = useAuthorFeed(identityIdParam, undefined, {
4445
getIsAborted,
4546
});

apps/polycentric/src/features/composer/ComposeSheetInner.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ export function ComposeSheetInner({
111111

112112
const event = await client.buildEvent(content);
113113

114-
console.log(event);
115-
116114
const signedEvent = await client.signEvent(event);
117115

118116
await client.commitEvent(signedEvent);

apps/polycentric/src/features/core/identity/IdentityHeader.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { Routes } from '@/src/common/constants';
33
import {
44
identiconUrl,
55
useCurrentIdentity,
6-
useUsername,
76
} from '@/src/common/lib/polycentric-hooks';
7+
import { useProfile } from '@/src/features/profile/hooks/useProfile';
88
import { useWebHover } from '@/src/common/lib/useWebHover';
99
import {
1010
Atoms,
@@ -21,7 +21,8 @@ export function IdentityHeader() {
2121
const { theme } = useTheme();
2222
const { hovered, onHoverIn, onHoverOut } = useWebHover();
2323

24-
const username = useUsername(currentIdentity?.identityKey);
24+
const profile = useProfile(currentIdentity?.identityKey);
25+
const username = profile.name ?? '';
2526

2627
// This component shouldn't mount if a current identity is not set.
2728
if (!currentIdentity?.identityKey) {

apps/polycentric/src/features/post/Post.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {
55
postIdToSequence,
66
timeAgo,
77
truncateName,
8-
useUsername,
98
type PostData,
109
} from '@/src/common/lib/polycentric-hooks';
10+
import { useProfile } from '@/src/features/profile/hooks/useProfile';
1111
import { useWebHover } from '@/src/common/lib/useWebHover';
1212
import {
1313
Atoms,
@@ -42,7 +42,8 @@ export const Post = memo(function Post({
4242

4343
const authorIdentity = post.identity ?? null;
4444

45-
const authorName = useUsername(authorIdentity);
45+
const authorProfile = useProfile(authorIdentity);
46+
const authorName = authorProfile.name ?? '';
4647

4748
const rawContent = post.content ?? '';
4849
const [contentExpanded, setContentExpanded] = useState(false);

0 commit comments

Comments
 (0)