-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fabri QA for frames & deeplinks #1098
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,6 +3,7 @@ import { useGroupName } from "@hooks/useGroupName"; | |||||||||||||||||||||||||||||
import { translate } from "@i18n"; | ||||||||||||||||||||||||||||||
import { useGroupQuery } from "@queries/useGroupQuery"; | ||||||||||||||||||||||||||||||
import { textPrimaryColor } from "@styles/colors"; | ||||||||||||||||||||||||||||||
import { isGroupTopic } from "@utils/groupUtils/groupId"; | ||||||||||||||||||||||||||||||
import { useCallback, useMemo } from "react"; | ||||||||||||||||||||||||||||||
import { | ||||||||||||||||||||||||||||||
Keyboard, | ||||||||||||||||||||||||||||||
|
@@ -25,6 +26,7 @@ type Props = { | |||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
export function GroupChatPlaceholder({ messagesCount }: Props) { | ||||||||||||||||||||||||||||||
const topic = useConversationContext("topic"); | ||||||||||||||||||||||||||||||
const conversation = useConversationContext("conversation"); | ||||||||||||||||||||||||||||||
const onReadyToFocus = useConversationContext("onReadyToFocus"); | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
|
@@ -74,9 +76,13 @@ export function GroupChatPlaceholder({ messagesCount }: Props) { | |||||||||||||||||||||||||||||
<View onLayout={onLayout} style={styles.chatPlaceholder}> | ||||||||||||||||||||||||||||||
{!conversation && ( | ||||||||||||||||||||||||||||||
<View> | ||||||||||||||||||||||||||||||
<ActivityIndicator style={styles.activitySpinner} /> | ||||||||||||||||||||||||||||||
{!topic && <ActivityIndicator style={{ marginBottom: 20 }} />} | ||||||||||||||||||||||||||||||
<Text style={styles.chatPlaceholderText}> | ||||||||||||||||||||||||||||||
{translate("opening_conversation")} | ||||||||||||||||||||||||||||||
{topic | ||||||||||||||||||||||||||||||
? isGroupTopic(topic) | ||||||||||||||||||||||||||||||
? translate("group_not_found") | ||||||||||||||||||||||||||||||
: translate("conversation_not_found") | ||||||||||||||||||||||||||||||
: translate("opening_conversation")} | ||||||||||||||||||||||||||||||
Comment on lines
+81
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider extracting placeholder text logic for better readability While the logic correctly implements the error message requirements, the nested ternary operators could be simplified for better maintainability. + const getPlaceholderText = () => {
+ if (!topic) return translate("opening_conversation");
+ return isGroupTopic(topic)
+ ? translate("group_not_found")
+ : translate("conversation_not_found");
+ };
<Text style={styles.chatPlaceholderText}>
- {topic
- ? isGroupTopic(topic)
- ? translate("group_not_found")
- : translate("conversation_not_found")
- : translate("opening_conversation")}
+ {getPlaceholderText()}
</Text> 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||
</Text> | ||||||||||||||||||||||||||||||
</View> | ||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should always be a group topic as it's in the GroupChatPlaceholder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexrisch The check to display ChatPlaceholder or GroupChatPlaceholder is currently on
conversation?.isGroup
so it only works if the conversation was found. Do you wanna change it toisGroupTopic(conversationTopic)
?