@planningcenter/chat-react-native 3.18.0-rc.1 → 3.18.0-rc.11
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/build/components/conversation/message.d.ts +2 -1
- package/build/components/conversation/message.d.ts.map +1 -1
- package/build/components/conversation/message.js +53 -26
- package/build/components/conversation/message.js.map +1 -1
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +7 -6
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/messages_disabled_banners.d.ts +3 -0
- package/build/components/conversation/messages_disabled_banners.d.ts.map +1 -0
- package/build/components/conversation/messages_disabled_banners.js +53 -0
- package/build/components/conversation/messages_disabled_banners.js.map +1 -0
- package/build/components/conversation/reply_connectors.d.ts.map +1 -1
- package/build/components/conversation/reply_connectors.js +0 -5
- package/build/components/conversation/reply_connectors.js.map +1 -1
- package/build/components/conversation/reply_shadow_message.d.ts.map +1 -1
- package/build/components/conversation/reply_shadow_message.js +8 -3
- package/build/components/conversation/reply_shadow_message.js.map +1 -1
- package/build/components/conversation/typing_indicator.d.ts +1 -5
- package/build/components/conversation/typing_indicator.d.ts.map +1 -1
- package/build/components/conversation/typing_indicator.js +2 -2
- package/build/components/conversation/typing_indicator.js.map +1 -1
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +1 -2
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +2 -3
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/contexts/conversation_context.d.ts +13 -0
- package/build/contexts/conversation_context.d.ts.map +1 -0
- package/build/contexts/conversation_context.js +14 -0
- package/build/contexts/conversation_context.js.map +1 -0
- package/build/hooks/use_broadcast_typing_status.d.ts +1 -1
- package/build/hooks/use_broadcast_typing_status.d.ts.map +1 -1
- package/build/hooks/use_broadcast_typing_status.js +7 -3
- package/build/hooks/use_broadcast_typing_status.js.map +1 -1
- package/build/hooks/use_conversation_messages.d.ts.map +1 -1
- package/build/hooks/use_conversation_messages.js +2 -1
- package/build/hooks/use_conversation_messages.js.map +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_messages_jolt_events.js +23 -70
- package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
- package/build/hooks/use_features.d.ts +9 -0
- package/build/hooks/use_features.d.ts.map +1 -0
- package/build/hooks/use_features.js +35 -0
- package/build/hooks/use_features.js.map +1 -0
- package/build/hooks/use_message_create_or_update.d.ts +0 -2
- package/build/hooks/use_message_create_or_update.d.ts.map +1 -1
- package/build/hooks/use_message_create_or_update.js +10 -8
- package/build/hooks/use_message_create_or_update.js.map +1 -1
- package/build/hooks/use_typing_indicators.d.ts +1 -1
- package/build/hooks/use_typing_indicators.d.ts.map +1 -1
- package/build/hooks/use_typing_indicators.js +16 -3
- package/build/hooks/use_typing_indicators.js.map +1 -1
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +9 -6
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_new/components/form_list.d.ts +2 -2
- package/build/screens/conversation_new/components/form_list.d.ts.map +1 -1
- package/build/screens/conversation_new/components/form_list.js +2 -3
- package/build/screens/conversation_new/components/form_list.js.map +1 -1
- package/build/screens/conversation_screen.d.ts +2 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +41 -18
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js +2 -3
- package/build/screens/conversation_select_recipients/conversation_select_group_recipients_screen.js.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.d.ts.map +1 -1
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js +2 -3
- package/build/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.js.map +1 -1
- package/build/screens/message_actions_screen.js +4 -2
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/types/jolt_events/reaction_events.d.ts +1 -0
- package/build/types/jolt_events/reaction_events.d.ts.map +1 -1
- package/build/types/jolt_events/reaction_events.js.map +1 -1
- package/build/types/jolt_events/typing_events.d.ts +1 -0
- package/build/types/jolt_events/typing_events.d.ts.map +1 -1
- package/build/types/jolt_events/typing_events.js.map +1 -1
- package/build/types/resources/feature_resource.d.ts +7 -0
- package/build/types/resources/feature_resource.d.ts.map +1 -0
- package/build/types/resources/feature_resource.js +2 -0
- package/build/types/resources/feature_resource.js.map +1 -0
- package/build/utils/cache/messages_cache.d.ts +9 -0
- package/build/utils/cache/messages_cache.d.ts.map +1 -0
- package/build/utils/cache/messages_cache.js +89 -0
- package/build/utils/cache/messages_cache.js.map +1 -0
- package/build/utils/cache/optimistically_create_message.d.ts +2 -1
- package/build/utils/cache/optimistically_create_message.d.ts.map +1 -1
- package/build/utils/cache/optimistically_create_message.js +6 -3
- package/build/utils/cache/optimistically_create_message.js.map +1 -1
- package/build/utils/index.d.ts +0 -1
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +0 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/request/get_features.d.ts +11 -0
- package/build/utils/request/get_features.d.ts.map +1 -0
- package/build/utils/request/get_features.js +18 -0
- package/build/utils/request/get_features.js.map +1 -0
- package/package.json +2 -3
- package/src/components/conversation/message.tsx +80 -29
- package/src/components/conversation/message_form.tsx +6 -11
- package/src/components/conversation/messages_disabled_banners.tsx +69 -0
- package/src/components/conversation/reply_connectors.tsx +0 -3
- package/src/components/conversation/reply_shadow_message.tsx +9 -2
- package/src/components/conversation/typing_indicator.tsx +2 -6
- package/src/components/conversations/conversation_actions.tsx +1 -1
- package/src/components/conversations/conversations.tsx +7 -9
- package/src/contexts/conversation_context.tsx +34 -0
- package/src/hooks/use_broadcast_typing_status.ts +7 -3
- package/src/hooks/use_conversation_messages.ts +3 -1
- package/src/hooks/use_conversation_messages_jolt_events.ts +39 -81
- package/src/hooks/use_features.ts +47 -0
- package/src/hooks/use_message_create_or_update.ts +10 -9
- package/src/hooks/use_typing_indicators.ts +15 -3
- package/src/screens/conversation_details_screen.tsx +9 -6
- package/src/screens/conversation_new/components/form_list.tsx +3 -5
- package/src/screens/conversation_screen.tsx +58 -20
- package/src/screens/conversation_select_recipients/conversation_select_group_recipients_screen.tsx +2 -4
- package/src/screens/conversation_select_recipients/conversation_select_teams_i_lead_recipients_screen.tsx +2 -4
- package/src/screens/message_actions_screen.tsx +4 -2
- package/src/types/jolt_events/reaction_events.ts +1 -0
- package/src/types/jolt_events/typing_events.ts +1 -0
- package/src/types/resources/feature_resource.ts +6 -0
- package/src/utils/cache/messages_cache.ts +113 -0
- package/src/utils/cache/optimistically_create_message.ts +7 -2
- package/src/utils/index.ts +0 -1
- package/src/utils/request/get_features.ts +20 -0
- package/build/components/conversation/disabled_replies_banners.d.ts +0 -3
- package/build/components/conversation/disabled_replies_banners.d.ts.map +0 -1
- package/build/components/conversation/disabled_replies_banners.js +0 -41
- package/build/components/conversation/disabled_replies_banners.js.map +0 -1
- package/build/utils/replies_local_feature_flag.d.ts +0 -2
- package/build/utils/replies_local_feature_flag.d.ts.map +0 -1
- package/build/utils/replies_local_feature_flag.js +0 -3
- package/build/utils/replies_local_feature_flag.js.map +0 -1
- package/src/components/conversation/disabled_replies_banners.tsx +0 -58
- package/src/utils/replies_local_feature_flag.ts +0 -2
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { InfiniteData, QueryClient } from '@tanstack/react-query'
|
|
2
|
+
import { ApiCollection, MessageResource } from '../../types'
|
|
3
|
+
import { deleteRecordInPagesData } from './page_mutations'
|
|
4
|
+
import { updateOrCreateRecordInPagesData, updateRecordInPagesData } from './page_mutations'
|
|
5
|
+
import { JoltReactionEvent } from '../../types/jolt_events'
|
|
6
|
+
import { transformReactionEventDataToReactionCountResource } from '../jolt/transform_reaction_event_data_to_reaction_count_resource'
|
|
7
|
+
import { getMessagesRequestArgs } from '../request/get_messages'
|
|
8
|
+
import { getRequestQueryKey } from '../../hooks/use_suspense_api'
|
|
9
|
+
|
|
10
|
+
export function updateCacheWithMessage(
|
|
11
|
+
queryClient: QueryClient,
|
|
12
|
+
queryKey: unknown[],
|
|
13
|
+
message: MessageResource,
|
|
14
|
+
event: 'message.created' | 'message.updated'
|
|
15
|
+
) {
|
|
16
|
+
queryClient.setQueryData<MessagesQueryData>(queryKey, prev => {
|
|
17
|
+
if (event === 'message.created') {
|
|
18
|
+
// Before adding the new message, remove any pending temporary messages
|
|
19
|
+
// with matching text to prevent duplicates from race conditions
|
|
20
|
+
let dataAfterTempRemoval = prev
|
|
21
|
+
if (prev && message.text && message.mine) {
|
|
22
|
+
dataAfterTempRemoval = deleteRecordInPagesData({
|
|
23
|
+
data: prev,
|
|
24
|
+
record: message,
|
|
25
|
+
matchFn: (existingMessage, _record) => {
|
|
26
|
+
return (
|
|
27
|
+
isTemporaryMessageId(existingMessage.id) &&
|
|
28
|
+
existingMessage.text === message.text &&
|
|
29
|
+
existingMessage.mine
|
|
30
|
+
)
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return updateOrCreateRecordInPagesData({
|
|
36
|
+
data: dataAfterTempRemoval,
|
|
37
|
+
record: message,
|
|
38
|
+
processRecord: (record, current) => {
|
|
39
|
+
return { ...current, ...record }
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
} else {
|
|
43
|
+
return updateRecordInPagesData({
|
|
44
|
+
data: prev,
|
|
45
|
+
record: message,
|
|
46
|
+
processRecord: (record, current) => {
|
|
47
|
+
return { ...current, ...record }
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function updateCacheWithReaction(
|
|
55
|
+
queryClient: QueryClient,
|
|
56
|
+
queryKey: unknown[],
|
|
57
|
+
event: JoltReactionEvent,
|
|
58
|
+
currentPersonId: number
|
|
59
|
+
) {
|
|
60
|
+
const message = { id: event.data.data.message_sort_key } as MessageResource
|
|
61
|
+
queryClient.setQueryData<MessagesQueryData>(queryKey, prev =>
|
|
62
|
+
updateRecordInPagesData({
|
|
63
|
+
data: prev,
|
|
64
|
+
record: message,
|
|
65
|
+
processRecord: (record, oldMessage) => {
|
|
66
|
+
const reactionCounts = oldMessage.reactionCounts || []
|
|
67
|
+
let foundMatch = false
|
|
68
|
+
let newReactionCounts = reactionCounts.map(reactionCount => {
|
|
69
|
+
if (reactionCount.value === event.data.data.value) {
|
|
70
|
+
foundMatch = true
|
|
71
|
+
return transformReactionEventDataToReactionCountResource({
|
|
72
|
+
data: event.data.data,
|
|
73
|
+
oldData: reactionCount,
|
|
74
|
+
event: event.event,
|
|
75
|
+
currentPersonId,
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
return reactionCount
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
if (!foundMatch) {
|
|
82
|
+
const newReactionCount = transformReactionEventDataToReactionCountResource({
|
|
83
|
+
data: event.data.data,
|
|
84
|
+
event: event.event,
|
|
85
|
+
currentPersonId,
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
if (newReactionCount?.count) {
|
|
89
|
+
newReactionCounts = [...newReactionCounts, newReactionCount]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return { ...oldMessage, reactionCounts: newReactionCounts }
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
type MessagesQueryData = InfiniteData<ApiCollection<MessageResource>>
|
|
100
|
+
export function isTemporaryMessageId(messageId?: string | null): boolean {
|
|
101
|
+
return !!messageId && messageId.endsWith('-temp')
|
|
102
|
+
}
|
|
103
|
+
export function isNewMessage(message?: MessageResource): boolean {
|
|
104
|
+
return !message?.id || isTemporaryMessageId(message.id)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function getThreadedMessagesQueryKey(conversationId: number, replyRootId: string) {
|
|
108
|
+
const requestArgs = getMessagesRequestArgs({
|
|
109
|
+
conversation_id: conversationId,
|
|
110
|
+
reply_root_id: replyRootId,
|
|
111
|
+
})
|
|
112
|
+
return getRequestQueryKey(requestArgs)
|
|
113
|
+
}
|
|
@@ -14,12 +14,14 @@ export function optimisticallyCreateMessage({
|
|
|
14
14
|
attachments,
|
|
15
15
|
currentPerson,
|
|
16
16
|
message,
|
|
17
|
+
replyRootId,
|
|
17
18
|
}: {
|
|
18
19
|
conversationId: number
|
|
19
20
|
text: string
|
|
20
21
|
attachments?: DenormalizedAttachmentResourceForCreate[]
|
|
21
22
|
currentPerson: CurrentPersonResource
|
|
22
23
|
message?: MessageResource
|
|
24
|
+
replyRootId?: string | null
|
|
23
25
|
}) {
|
|
24
26
|
const id = message?.id || generateTempMessageId()
|
|
25
27
|
|
|
@@ -49,12 +51,15 @@ export function optimisticallyCreateMessage({
|
|
|
49
51
|
lastInGroup: true,
|
|
50
52
|
pending: true,
|
|
51
53
|
replyCount: 0,
|
|
52
|
-
replyRootId: null,
|
|
54
|
+
replyRootId: replyRootId || null,
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
// Add the optimistic message to the cache
|
|
56
58
|
type QueryData = InfiniteData<ApiCollection<MessageResource>>
|
|
57
|
-
const queryKey = getMessagesQueryKey({
|
|
59
|
+
const queryKey = getMessagesQueryKey({
|
|
60
|
+
conversation_id: conversationId,
|
|
61
|
+
reply_root_id: replyRootId,
|
|
62
|
+
})
|
|
58
63
|
|
|
59
64
|
chatQueryClient.setQueryData<QueryData>(queryKey, data =>
|
|
60
65
|
updateOrCreateRecordInPagesData({
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getRequestQueryKey } from '../../hooks/use_suspense_api'
|
|
2
|
+
|
|
3
|
+
export const getFeaturesRequestArgs = () => {
|
|
4
|
+
const url = '/me/features'
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
url,
|
|
8
|
+
data: {
|
|
9
|
+
perPage: 100,
|
|
10
|
+
fields: {
|
|
11
|
+
Feature: ['name', 'enabled'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const getFeaturesQueryKey = () => {
|
|
18
|
+
const requestArgs = getFeaturesRequestArgs()
|
|
19
|
+
return getRequestQueryKey(requestArgs)
|
|
20
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disabled_replies_banners.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/disabled_replies_banners.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,2BAA2B,mCAEvC,CAAA;AAED,eAAO,MAAM,2BAA2B,mCAQvC,CAAA"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { StyleSheet, View } from 'react-native';
|
|
2
|
-
import { useTheme } from '../../hooks';
|
|
3
|
-
import { Text } from '../display';
|
|
4
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
-
export const LeaderDisabledRepliesBanner = () => {
|
|
6
|
-
return <DisabledRepliesBanner description="Replies are frozen for everyone else."/>;
|
|
7
|
-
};
|
|
8
|
-
export const MemberDisabledRepliesBanner = () => {
|
|
9
|
-
const styles = useStyles();
|
|
10
|
-
return (<DisabledRepliesBanner description="Replies have been disabled by a leader, but you can still add reactions." style={styles.memberBanner}/>);
|
|
11
|
-
};
|
|
12
|
-
const DisabledRepliesBanner = ({ description, style }) => {
|
|
13
|
-
const styles = useStyles();
|
|
14
|
-
return (<View style={[styles.baseBanner, style]}>
|
|
15
|
-
<Text style={styles.text} variant="tertiary">
|
|
16
|
-
{description}
|
|
17
|
-
</Text>
|
|
18
|
-
</View>);
|
|
19
|
-
};
|
|
20
|
-
const useStyles = () => {
|
|
21
|
-
const { colors } = useTheme();
|
|
22
|
-
const { bottom } = useSafeAreaInsets();
|
|
23
|
-
return StyleSheet.create({
|
|
24
|
-
baseBanner: {
|
|
25
|
-
paddingHorizontal: 16,
|
|
26
|
-
paddingVertical: 4,
|
|
27
|
-
backgroundColor: colors.statusNeutralComposedBackground,
|
|
28
|
-
borderTopWidth: 1,
|
|
29
|
-
borderTopColor: colors.borderColorDefaultBase,
|
|
30
|
-
},
|
|
31
|
-
text: {
|
|
32
|
-
textAlign: 'center',
|
|
33
|
-
},
|
|
34
|
-
memberBanner: {
|
|
35
|
-
paddingTop: 16,
|
|
36
|
-
paddingBottom: 16 + bottom,
|
|
37
|
-
marginBottom: -bottom,
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=disabled_replies_banners.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disabled_replies_banners.js","sourceRoot":"","sources":["../../../src/components/conversation/disabled_replies_banners.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,OAAO,CAAC,qBAAqB,CAAC,WAAW,CAAC,uCAAuC,EAAG,CAAA;AACtF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,OAAO,CACL,CAAC,qBAAqB,CACpB,WAAW,CAAC,0EAA0E,CACtF,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,EAC3B,CACH,CAAA;AACH,CAAC,CAAA;AAOD,MAAM,qBAAqB,GAAG,CAAC,EAAE,WAAW,EAAE,KAAK,EAA8B,EAAE,EAAE;IACnF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CACtC;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAC1C;QAAA,CAAC,WAAW,CACd;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,UAAU,EAAE;YACV,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,CAAC;YAClB,eAAe,EAAE,MAAM,CAAC,+BAA+B;YACvD,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,MAAM,CAAC,sBAAsB;SAC9C;QACD,IAAI,EAAE;YACJ,SAAS,EAAE,QAAQ;SACpB;QACD,YAAY,EAAE;YACZ,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE,GAAG,MAAM;YAC1B,YAAY,EAAE,CAAC,MAAM;SACtB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StyleSheet, View, type ViewStyle } from 'react-native'\nimport { useTheme } from '../../hooks'\nimport { Text } from '../display'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nexport const LeaderDisabledRepliesBanner = () => {\n return <DisabledRepliesBanner description=\"Replies are frozen for everyone else.\" />\n}\n\nexport const MemberDisabledRepliesBanner = () => {\n const styles = useStyles()\n return (\n <DisabledRepliesBanner\n description=\"Replies have been disabled by a leader, but you can still add reactions.\"\n style={styles.memberBanner}\n />\n )\n}\n\ninterface DisabledRepliesBannerProps {\n description: string\n style?: ViewStyle\n}\n\nconst DisabledRepliesBanner = ({ description, style }: DisabledRepliesBannerProps) => {\n const styles = useStyles()\n\n return (\n <View style={[styles.baseBanner, style]}>\n <Text style={styles.text} variant=\"tertiary\">\n {description}\n </Text>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n baseBanner: {\n paddingHorizontal: 16,\n paddingVertical: 4,\n backgroundColor: colors.statusNeutralComposedBackground,\n borderTopWidth: 1,\n borderTopColor: colors.borderColorDefaultBase,\n },\n text: {\n textAlign: 'center',\n },\n memberBanner: {\n paddingTop: 16,\n paddingBottom: 16 + bottom,\n marginBottom: -bottom,\n },\n })\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replies_local_feature_flag.d.ts","sourceRoot":"","sources":["../../src/utils/replies_local_feature_flag.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,uBAAuB,QAAQ,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replies_local_feature_flag.js","sourceRoot":"","sources":["../../src/utils/replies_local_feature_flag.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAA","sourcesContent":["// TODO: Replace this whole file with the flipper flag\nexport const REPLIES_FEATURE_ENABLED = false\n"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { StyleSheet, View, type ViewStyle } from 'react-native'
|
|
2
|
-
import { useTheme } from '../../hooks'
|
|
3
|
-
import { Text } from '../display'
|
|
4
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
|
-
|
|
6
|
-
export const LeaderDisabledRepliesBanner = () => {
|
|
7
|
-
return <DisabledRepliesBanner description="Replies are frozen for everyone else." />
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const MemberDisabledRepliesBanner = () => {
|
|
11
|
-
const styles = useStyles()
|
|
12
|
-
return (
|
|
13
|
-
<DisabledRepliesBanner
|
|
14
|
-
description="Replies have been disabled by a leader, but you can still add reactions."
|
|
15
|
-
style={styles.memberBanner}
|
|
16
|
-
/>
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface DisabledRepliesBannerProps {
|
|
21
|
-
description: string
|
|
22
|
-
style?: ViewStyle
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const DisabledRepliesBanner = ({ description, style }: DisabledRepliesBannerProps) => {
|
|
26
|
-
const styles = useStyles()
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<View style={[styles.baseBanner, style]}>
|
|
30
|
-
<Text style={styles.text} variant="tertiary">
|
|
31
|
-
{description}
|
|
32
|
-
</Text>
|
|
33
|
-
</View>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const useStyles = () => {
|
|
38
|
-
const { colors } = useTheme()
|
|
39
|
-
const { bottom } = useSafeAreaInsets()
|
|
40
|
-
|
|
41
|
-
return StyleSheet.create({
|
|
42
|
-
baseBanner: {
|
|
43
|
-
paddingHorizontal: 16,
|
|
44
|
-
paddingVertical: 4,
|
|
45
|
-
backgroundColor: colors.statusNeutralComposedBackground,
|
|
46
|
-
borderTopWidth: 1,
|
|
47
|
-
borderTopColor: colors.borderColorDefaultBase,
|
|
48
|
-
},
|
|
49
|
-
text: {
|
|
50
|
-
textAlign: 'center',
|
|
51
|
-
},
|
|
52
|
-
memberBanner: {
|
|
53
|
-
paddingTop: 16,
|
|
54
|
-
paddingBottom: 16 + bottom,
|
|
55
|
-
marginBottom: -bottom,
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
}
|