Skip to content

Commit

Permalink
improve: table search & suggestions search placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonardoD committed Dec 31, 2024
1 parent 671594d commit 9ac5ee0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions frontend/src/modules/common/data-table/table-search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ const TableSearch = ({ value = '', setQuery }: TableSearchProps) => {

const handleClick = () => inputRef.current?.focus();

// Update parent query only when debouncedQuery changes
useEffect(() => {
setQuery(debouncedQuery);
if (debouncedQuery !== value) setQuery(debouncedQuery);
}, [debouncedQuery]);

// Reset input value when the external value changes
useEffect(() => {
if (value !== inputValue) setInputValue('');
if (!inputRef.current || document.activeElement !== inputRef.current) setInputValue(value);
}, [value]);

// Focus input when filter button is active (for mobile)
Expand All @@ -55,7 +56,10 @@ const TableSearch = ({ value = '', setQuery }: TableSearchProps) => {
<XCircle
size={16}
className="absolute right-3 top-1/2 opacity-70 hover:opacity-100 -translate-y-1/2 cursor-pointer"
onClick={() => setQuery('')}
onClick={() => {
setInputValue('');
setQuery('');
}}
/>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
"general": "General",
"get_directions": "Get directions",
"get_started": "Get started",
"global_search.text": "Search organizations & users within {{appName}}.",
"global_search.text": "Search for entities you belong to and users you share membership with in {{appName}}.",
"hi": "Hey there!",
"hide": "Hide",
"history": "History",
Expand All @@ -198,7 +198,7 @@
"invite_by_name": "Invite by searching for users",
"invite_create_account": "Sign up to accept invitation",
"invite_members.text": "Invited members will receive an email to accept the invitation.",
"invite_members_search.text": "Search for users to invite within {{appName}}.",
"invite_members_search.text": "Search for users to invite within {{appName}} who share a membership with you or are part of the same entity.",
"invite_only.text": "{{appName}} is currently invite-only. Can't wait? Contact us for an invite.",
"invite_sign_in": "Sign in to accept the invitation",
"invite_sign_in_or_up": "Sign in or sign up to accept the invitation",
Expand Down

0 comments on commit 9ac5ee0

Please sign in to comment.