From 36845fd5bf69521c2f911ade9df65252093bfb75 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 27 Aug 2024 15:16:00 -0400 Subject: [PATCH 1/4] fix: now search dialog is always on top of other elements --- .../organisms/SearchDialog/search-dialog.tsx | 102 +++++++++++------- 1 file changed, 61 insertions(+), 41 deletions(-) diff --git a/components/organisms/SearchDialog/search-dialog.tsx b/components/organisms/SearchDialog/search-dialog.tsx index b40e3603c..d52a9a167 100644 --- a/components/organisms/SearchDialog/search-dialog.tsx +++ b/components/organisms/SearchDialog/search-dialog.tsx @@ -15,6 +15,7 @@ import useDebounceTerm from "lib/hooks/useDebounceTerm"; import useIsMacOS from "lib/hooks/useIsMacOS"; import useSupabaseAuth from "lib/hooks/useSupabaseAuth"; import { useSearchRepos } from "lib/hooks/useSearchRepos"; +import { Dialog, DialogContent, DialogTrigger } from "components/molecules/Dialog/dialog"; const SearchDialog = () => { useLockBody(); @@ -26,6 +27,7 @@ const SearchDialog = () => { const [isSearching, setIsSearching] = useState(false); const [isSearchError, setIsSearchError] = useState(false); const setOpenSearch = store((state) => state.setOpenSearch); + const openSearch = store((state) => state.openSearch); const debouncedSearchTerm = useDebounceTerm(searchTerm, 300); const { data: repoData, @@ -136,50 +138,68 @@ const SearchDialog = () => { }; return ( -
-
setOpenSearch(false)} /> -
cursor !== -1 && setCursor(-1)} - > -
- {isSearching ? ( -
- ) : ( + + + + + +
+
setOpenSearch(false)} + /> +
cursor !== -1 && setCursor(-1)} + > +
+ {isSearching ? ( +
+ ) : ( + + )} + { + setSearchTerm(e.target.value); + isSearchError && setIsSearchError(false); + }} + onKeyDown={handleKeyboardCtrl} + /> + + {isMac ? "⌘K" : CTRL+K} + +
+
+ {searchTerm.length < 3 ? ( + + ) : isSearchError && !isSearching && (repoDataError || repoData.length === 0) ? ( + + + We couldn't find any users or repositories with that name + + ) : ( + <> +
{renderUserSearchState()}
+
+
{renderRepoSearchState()}
+ + )} +
+
-
- {searchTerm.length < 3 ? ( - - ) : isSearchError && !isSearching && (repoDataError || repoData.length === 0) ? ( - - - We couldn't find any users or repositories with that name - - ) : ( - <> -
{renderUserSearchState()}
-
-
{renderRepoSearchState()}
- - )} -
-
-
+
+
); }; From e4a2ea84961323da46d4f6e6b52b1728211b824b Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 27 Aug 2024 15:28:52 -0400 Subject: [PATCH 2/4] removed unused JSX snippet --- components/organisms/SearchDialog/search-dialog.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/components/organisms/SearchDialog/search-dialog.tsx b/components/organisms/SearchDialog/search-dialog.tsx index d52a9a167..20313cefd 100644 --- a/components/organisms/SearchDialog/search-dialog.tsx +++ b/components/organisms/SearchDialog/search-dialog.tsx @@ -257,13 +257,6 @@ const SearchLoading = () => (
); -const SearchError = () => ( - - - We couldn't find any users or repositories with that name - -); - const SearchResult = ({ result, cursor }: { result: GhUser[]; cursor: number }) => (
Users From a482d9a87309437d449a6cac6b32c64c95655005 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 27 Aug 2024 15:45:28 -0400 Subject: [PATCH 3/4] wip --- .../organisms/SearchDialog/search-dialog.tsx | 101 ++++++++---------- 1 file changed, 45 insertions(+), 56 deletions(-) diff --git a/components/organisms/SearchDialog/search-dialog.tsx b/components/organisms/SearchDialog/search-dialog.tsx index 20313cefd..6d2ecad92 100644 --- a/components/organisms/SearchDialog/search-dialog.tsx +++ b/components/organisms/SearchDialog/search-dialog.tsx @@ -15,7 +15,7 @@ import useDebounceTerm from "lib/hooks/useDebounceTerm"; import useIsMacOS from "lib/hooks/useIsMacOS"; import useSupabaseAuth from "lib/hooks/useSupabaseAuth"; import { useSearchRepos } from "lib/hooks/useSearchRepos"; -import { Dialog, DialogContent, DialogTrigger } from "components/molecules/Dialog/dialog"; +import { Dialog, DialogContent } from "components/molecules/Dialog/dialog"; const SearchDialog = () => { useLockBody(); @@ -139,63 +139,52 @@ const SearchDialog = () => { return ( - - - - -
-
setOpenSearch(false)} - /> -
cursor !== -1 && setCursor(-1)} - > -
- {isSearching ? ( -
- ) : ( - - )} - { - setSearchTerm(e.target.value); - isSearchError && setIsSearchError(false); - }} - onKeyDown={handleKeyboardCtrl} - /> - - {isMac ? "⌘K" : CTRL+K} +
+ {searchTerm.length < 3 ? ( + + ) : isSearchError && !isSearching && (repoDataError || repoData.length === 0) ? ( + + + We couldn't find any users or repositories with that name -
-
- {searchTerm.length < 3 ? ( - - ) : isSearchError && !isSearching && (repoDataError || repoData.length === 0) ? ( - - - We couldn't find any users or repositories with that name - - ) : ( - <> -
{renderUserSearchState()}
-
-
{renderRepoSearchState()}
- - )} -
+ ) : ( + <> +
{renderUserSearchState()}
+
+
{renderRepoSearchState()}
+ + )}
From a21fe0b5c74b85a760c45d93ee7ced1817de726c Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Tue, 27 Aug 2024 16:11:24 -0400 Subject: [PATCH 4/4] cleaned up some styles --- components/organisms/SearchDialog/search-dialog.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/organisms/SearchDialog/search-dialog.tsx b/components/organisms/SearchDialog/search-dialog.tsx index 6d2ecad92..38d4c3721 100644 --- a/components/organisms/SearchDialog/search-dialog.tsx +++ b/components/organisms/SearchDialog/search-dialog.tsx @@ -140,14 +140,13 @@ const SearchDialog = () => { return ( { - alert("clicked outside"); setOpenSearch(false); }} >
cursor !== -1 && setCursor(-1)} >