@openpeepshq/rn-components 0.9.0 → 0.9.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/rn-components",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./src/index.ts",
@@ -142,8 +142,8 @@
142
142
  "timezones-list": "^3.1.0",
143
143
  "validator": "^13.15.23",
144
144
  "zustand": "^5.0.3",
145
- "@openpeepshq/common": "^0.5.0",
146
- "@openpeepshq/react": "^0.9.0"
145
+ "@openpeepshq/react": "^0.9.1",
146
+ "@openpeepshq/common": "^0.5.0"
147
147
  },
148
148
  "devDependencies": {
149
149
  "@babel/core": "^7.26.7",
@@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { MainScreenProps } from '../../components/navigation/types/index';
3
3
  import {
4
4
  adjustUnseenCounts,
5
+ apiErrorMessage,
5
6
  useOpenpeeps,
6
7
  usePostViewFlush,
7
8
  } from '@openpeepshq/react';
@@ -16,6 +17,7 @@ import {
16
17
  Platform,
17
18
  ActivityIndicator,
18
19
  } from 'react-native';
20
+ import Toast from 'react-native-toast-message';
19
21
  import { InfoIcon, SearchIcon } from '../../components/icons/index';
20
22
  import { MediaAttachmentData, type PublicPost } from '@openpeepshq/common';
21
23
  import { ComposeAttachments } from '../../components/post/post-form/ComposeAttachments';
@@ -133,6 +135,10 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
133
135
  scrollViewRef.current?.scrollToEnd({ animated: true });
134
136
  } catch (error) {
135
137
  console.error('Failed to send message:', error);
138
+ Toast.show({
139
+ type: 'error',
140
+ text1: apiErrorMessage(error, t, t('conversations.sendError')),
141
+ });
136
142
  } finally {
137
143
  setIsSending(false);
138
144
  }
@@ -5,6 +5,7 @@ import Toast from 'react-native-toast-message';
5
5
  import { useNewEvent } from '@openpeepshq/react';
6
6
  import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
7
7
  import { ThemedView } from '../../components/ui/themed-view';
8
+ import { ThemedText } from '../../components/ui/themed-text';
8
9
  import { MainScreenProps } from '../../components/navigation/types/index';
9
10
  import { EventForm } from '../../components/post/index';
10
11
 
@@ -15,6 +16,7 @@ export const NewEvent = (_props: NewEventProps) => {
15
16
  const {
16
17
  postData,
17
18
  setPostData,
19
+ canCreate,
18
20
  canSubmit,
19
21
  submitting,
20
22
  error,
@@ -33,14 +35,32 @@ export const NewEvent = (_props: NewEventProps) => {
33
35
 
34
36
  useSetPageHeader(
35
37
  t('events.create.title'),
36
- <HeaderActionButton
37
- title={submitting ? t('common.submitting') : t('events.create.title')}
38
- onPress={() => void submit()}
39
- disabled={submitting || !canSubmit}
40
- loading={submitting}
41
- />
38
+ canCreate ? (
39
+ <HeaderActionButton
40
+ title={submitting ? t('common.submitting') : t('events.create.title')}
41
+ onPress={() => void submit()}
42
+ disabled={submitting || !canSubmit}
43
+ loading={submitting}
44
+ />
45
+ ) : undefined
42
46
  );
43
47
 
48
+ if (!canCreate) {
49
+ return (
50
+ <ThemedView
51
+ className="flex-1 items-center justify-center gap-2 px-6 py-16"
52
+ testID="events-create-not-allowed"
53
+ >
54
+ <ThemedText className="text-center text-xl font-semibold">
55
+ {t('events.create.notAllowed.title')}
56
+ </ThemedText>
57
+ <ThemedText className="text-muted-foreground text-center text-sm">
58
+ {t('events.create.notAllowed.description')}
59
+ </ThemedText>
60
+ </ThemedView>
61
+ );
62
+ }
63
+
44
64
  return (
45
65
  <ThemedView className="flex-1">
46
66
  <KeyboardAwareScrollView
@@ -5,7 +5,7 @@ import React, {
5
5
  useRef,
6
6
  useState,
7
7
  } from 'react';
8
- import { useOpenpeeps } from '@openpeepshq/react';
8
+ import { apiErrorMessage, useOpenpeeps } from '@openpeepshq/react';
9
9
  import {
10
10
  AudioPickerSheet,
11
11
  DocumentPickerSheet,
@@ -165,8 +165,11 @@ export const ReplyPost = ({ route, navigation }: PostProps) => {
165
165
  await createPost(postData as PostCreationData);
166
166
 
167
167
  handlePostSuccess();
168
- } catch {
169
- Toast.show({ type: 'error', text1: t('posts.replyModal.errorToast') });
168
+ } catch (err) {
169
+ Toast.show({
170
+ type: 'error',
171
+ text1: apiErrorMessage(err, t, t('posts.replyModal.errorToast')),
172
+ });
170
173
  } finally {
171
174
  setIsPosting(false);
172
175
  }