Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

feat(app): show an empty state in the recipient picker

Hampus05b65834d6db
diff --git a/fluxer_app/src/features/app/components/dialogs/shared/RecipientList.module.css b/fluxer_app/src/features/app/components/dialogs/shared/RecipientList.module.css
index b6f197012..9f8d1a9d3 100644
--- a/fluxer_app/src/features/app/components/dialogs/shared/RecipientList.module.css
+++ b/fluxer_app/src/features/app/components/dialogs/shared/RecipientList.module.css
@@ -28,10 +28,14 @@
.noResults {
display: flex;
height: 100%;
+ min-height: 6rem;
flex-direction: column;
align-items: center;
justify-content: center;
+ padding: var(--spacing-4) 1rem;
color: var(--text-secondary);
+ text-align: center;
+ text-wrap: pretty;
font-size: 1rem;
font-weight: 500;
}
diff --git a/fluxer_app/src/features/app/components/dialogs/shared/RecipientList.tsx b/fluxer_app/src/features/app/components/dialogs/shared/RecipientList.tsx
index 3cc0253ac..f2c61e769 100644
--- a/fluxer_app/src/features/app/components/dialogs/shared/RecipientList.tsx
+++ b/fluxer_app/src/features/app/components/dialogs/shared/RecipientList.tsx
@@ -124,6 +124,7 @@ interface RecipientListProps {
searchQuery?: string;
onSearchQueryChange?: (value: string) => void;
showSearchInput?: boolean;
+ emptyText?: React.ReactNode;
}
export const RecipientList = observer((props: RecipientListProps) => {
@@ -142,6 +143,11 @@ export const RecipientList = observer((props: RecipientListProps) => {
return username.includes(query) || displayName.includes(query) || channelName.includes(query);
});
}, [searchQuery, props.recipients]);
+ const emptyText = props.emptyText ?? (
+ <Trans comment="Shown in a list of people to choose from when the account has no friends and no direct messages yet.">
+ No friends or direct messages yet.
+ </Trans>
+ );
const handleSearchChange = (value: string) => {
if (props.onSearchQueryChange) {
props.onSearchQueryChange(value);
@@ -177,7 +183,7 @@ export const RecipientList = observer((props: RecipientListProps) => {
>
{filteredRecipients.length === 0 ? (
<div className={styles.noResults} data-flx="app.recipient-list.no-results">
- {<Trans>No friends match that.</Trans>}
+ {searchQuery.trim() ? <Trans>No friends match that.</Trans> : emptyText}
</div>
) : (
<div className={styles.friendList} data-flx="app.recipient-list.friend-list">