@openpeepshq/rn-components 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/lib/utils.ts CHANGED
@@ -72,22 +72,6 @@ export const formatEventDate = (dateString: string) => {
72
72
  });
73
73
  };
74
74
 
75
- export const getInitials = (profile?: Profile) => {
76
- if (!profile?.displayName) {
77
- return profile?.handle?.charAt(0)?.toUpperCase();
78
- }
79
- let initials = '';
80
- const [first, last] = profile?.displayName.split(' ');
81
- if (first) {
82
- initials += first.charAt(0).toUpperCase();
83
- }
84
- if (last) {
85
- initials += last.charAt(0).toUpperCase();
86
- }
87
-
88
- return initials;
89
- };
90
-
91
75
  export const ChatDateFormatter = (date: string) => {
92
76
  const options: Intl.DateTimeFormatOptions = {
93
77
  weekday: 'long',
@@ -216,13 +200,17 @@ export const isPostPath = (path: string) =>
216
200
  path.startsWith('/posts/') && path.substring(7);
217
201
 
218
202
  export const isLocalLink = (url: string, origin: string) => {
219
- const urlObj = new URL(url);
220
- return (
221
- urlObj.origin === origin &&
222
- (isPostPath(urlObj.pathname) ||
223
- isJamPath(urlObj.pathname) ||
224
- isGroupPath(urlObj.pathname))
225
- );
203
+ try {
204
+ const urlObj = new URL(url);
205
+ return (
206
+ urlObj.origin === origin &&
207
+ (isPostPath(urlObj.pathname) ||
208
+ isJamPath(urlObj.pathname) ||
209
+ isGroupPath(urlObj.pathname))
210
+ );
211
+ } catch {
212
+ return false;
213
+ }
226
214
  };
227
215
 
228
216
  export const isValidUrl = (url?: string) => {
@@ -100,7 +100,7 @@ export const Members: React.FC<DirectoryProps> = ({ navigation }) => {
100
100
  >
101
101
  <MessageSquareTextIcon className="size-10 text-foreground" />
102
102
  </Pressable>
103
- <FollowUnfollowButton profile={profile} />
103
+ <FollowUnfollowButton profile={profile} compact />
104
104
  </View>
105
105
  ) : null
106
106
  }