Skip to content

Commit

Permalink
🚸 Show when user search results are incomplete (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericlinagora committed May 13, 2024
1 parent 1a66a6f commit b121f6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions tdrive/frontend/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"scenes.app.workspaces.create_company.group_data.group_main_activity.other": "Other",
"components.drive_dropzone.uploading": "Uploading...",
"components.user_picker.modal_no_result": "No results found",
"components.user_picker.modal_results_trucated": "First {{$1}} results of {{$2}} shown...",
"components.users_picker.add_me": "Add me",
"scenes.app.workspaces.create_company.invitations.title": "Configure your workspace.",
"scenes.app.header.disconnected": "You are disconnected",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default (props: {
const { search, result, query } = useSearchUsers({ scope: 'company' });
const [isFocus, setFocus] = useState(false);
const inputElement = useRef<HTMLInputElement>(null);
const maxUserResultsShown = 5;

useEffect(() => {
if (users.length) props.onChange(users);
Expand Down Expand Up @@ -55,7 +56,7 @@ export default (props: {
<Info>{Languages.t('components.user_picker.modal_no_result')}</Info>
</div>
)}
{_.reverse(result.slice(0, 5)).map((user, i) => {
{_.reverse(result.slice(0, maxUserResultsShown)).map((user, i) => {
return (
<div key={user.id} className={"rounded m-1 p-3 new-direct-channel-proposed-user flex flex-row items-center justify-center align-baseline" + (i > 0 ? ' border-t' : '')}>
<div className="grow">
Expand All @@ -78,6 +79,12 @@ export default (props: {
</div>
);
})}
{result.length > maxUserResultsShown &&
<div className='grow text-center italic'>
{Languages.t('components.user_picker.modal_results_trucated',
[maxUserResultsShown, result.length],
'First {{$1}} results of {{$2}} shown...')}
</div>}
<div className='-mb-px' />
</div>
</div>
Expand Down

0 comments on commit b121f6c

Please sign in to comment.