diff --git a/CHANGELOG.md b/CHANGELOG.md index 0803ca7b..0ee8c046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ > All notable changes to this project will be documented in this file +## [2.37.1-beta.1](https://github.com/open-sauced/hot/compare/v2.37.0...v2.37.1-beta.1) (2024-04-14) + + +### πŸ› Bug Fixes + +* searching broke the page and make it blank ([#524](https://github.com/open-sauced/hot/issues/524)) ([82f67da](https://github.com/open-sauced/hot/commit/82f67dadbd88b978c8869737a27d168a932b120b)) + ## [2.37.0](https://github.com/open-sauced/hot/compare/v2.36.0...v2.37.0) (2024-04-13) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 404b184f..ca42e40c 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "@open-sauced/hot", - "version": "2.37.0", + "version": "2.37.1-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@open-sauced/hot", - "version": "2.37.0", + "version": "2.37.1-beta.1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index ad5e59d2..609d5ebc 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@open-sauced/hot", "description": "πŸ•The site that recommends the hottest sauce.", "keywords": [], - "version": "2.37.0", + "version": "2.37.1-beta.1", "author": "TED Vortex ", "private": true, "license": "MIT", diff --git a/public/diagram.svg b/public/diagram.svg index 7586b42c..56a50428 100644 --- a/public/diagram.svg +++ b/public/diagram.svg @@ -1 +1 @@ -liblibhookshookscomponentscomponentsassetsassetsvalidateUrl.test.tsvalidateUrl.test.tsvalidateUrl.test.tssupabase.tssupabase.tssupabase.tsvalidateUrl.tsvalidateUrl.tsvalidateUrl.tsgetDateFr...getDateFr...getDateFr...locations...locations...locations...humanize...humanize...humanize...reactHot...reactHot...reactHot...github.tsgithub.tsgithub.tsuseSupabase...useSupabase...useSupabase...useContri...useContri...useContri...useRepos...useRepos...useRepos...PrimaryNav.tsxPrimaryNav.tsxPrimaryNav.tsxFooter.tsxFooter.tsxFooter.tsxHero.tsxHero.tsxHero.tsxAdminStatusBar.tsxAdminStatusBar.tsxAdminStatusBar.tsxRepoSubmission.tsxRepoSubmission.tsxRepoSubmission.tsxHotRepoCard.tsxHotRepoCard.tsxHotRepoCard.tsxAvatar.tsxAvatar.tsxAvatar.tsxSearchedRepoCa...SearchedRepoCa...SearchedRepoCa...RepoList.tsxRepoList.tsxRepoList.tsxStarTheRepo.tsxStarTheRepo.tsxStarTheRepo.tsxSecondaryNav...SecondaryNav...SecondaryNav...ListReposit...ListReposit...ListReposit...HotReposit...HotReposit...HotReposit...RepoListW...RepoListW...RepoListW...StackedAv...StackedAv...StackedAv...styles/index.cssstyles/index.cssstyles/index.csse2e-tests/loggedOu...e2e-tests/loggedOu...e2e-tests/loggedOu...App.tsxApp.tsxApp.tsxvite-types.d.tsvite-types.d.tsvite-types.d.ts.css.svg.ts.tsxeach dot sized by file size \ No newline at end of file +liblibhookshookscomponentscomponentsassetsassetsvalidateUrl.test.tsvalidateUrl.test.tsvalidateUrl.test.tsvalidateUrl.tsvalidateUrl.tsvalidateUrl.tssupabase.tssupabase.tssupabase.tsgetDateFr...getDateFr...getDateFr...locations...locations...locations...humanizeN...humanizeN...humanizeN...reactHot...reactHot...reactHot...github.tsgithub.tsgithub.tsanalytic...analytic...analytic...useSupabase...useSupabase...useSupabase...useContri...useContri...useContri...useRepos...useRepos...useRepos...PrimaryNav.tsxPrimaryNav.tsxPrimaryNav.tsxFooter.tsxFooter.tsxFooter.tsxAdminStatusBar.tsxAdminStatusBar.tsxAdminStatusBar.tsxRepoSubmission.tsxRepoSubmission.tsxRepoSubmission.tsxHotRepoCard.tsxHotRepoCard.tsxHotRepoCard.tsxAvatar.tsxAvatar.tsxAvatar.tsxSearchedRepoCa...SearchedRepoCa...SearchedRepoCa...RepoList.tsxRepoList.tsxRepoList.tsxStarTheRepo.tsxStarTheRepo.tsxStarTheRepo.tsxSecondaryNav...SecondaryNav...SecondaryNav...ListReposito...ListReposito...ListReposito...HotReposit...HotReposit...HotReposit...RepoListWr...RepoListWr...RepoListWr...StackedAv...StackedAv...StackedAv...Hero.tsxHero.tsxHero.tsxstyles/index.cssstyles/index.cssstyles/index.csse2e-tests/loggedOu...e2e-tests/loggedOu...e2e-tests/loggedOu...App.tsxApp.tsxApp.tsxvite-types.d.tsvite-types.d.tsvite-types.d.ts.css.svg.ts.tsxeach dot sized by file size \ No newline at end of file diff --git a/src/components/Hero.tsx b/src/components/Hero.tsx index c62d1191..5c5cb478 100644 --- a/src/components/Hero.tsx +++ b/src/components/Hero.tsx @@ -1,139 +1,18 @@ -import { MutableRefObject, useRef, useState } from "react"; -import { useDebounce, useDidUpdate, useKeys } from "rooks"; - -import { fetchRecommendations } from "../lib/supabase"; -import searchNormal from "../assets/searchNormal.svg"; -import cmdKIcon from "../assets/cmdK.svg"; -import SearchedRepoCard from "./SearchedRepoCard"; -import { Combobox } from "@headlessui/react"; - -const Hero = () => { - const containerRef = useRef(document); - const searchBoxRef = useRef(null); - const comboButtonRef = useRef(null); - const [searchTerm, setSearchTerm] = useState(""); - const setValueDebounced = useDebounce(setSearchTerm, 500); - const [fetchedData, setFetchedData] = useState([]); - const [comboBoxSelection, setComboBoxSelection] = useState(""); - const [hasFocus, setFocus] = useState(false); - - const handleCmdK = async (e: KeyboardEvent) => { - comboButtonRef.current?.click(); - if (!hasFocus) { - searchBoxRef.current?.focus(); - setFocus(true); - const results = await fetchRecommendations(3, searchTerm); - - setFetchedData(results); - } else { - searchBoxRef.current?.blur(); - setFocus(false); - } - - // prevent browser from handling CMD/CTRL + K - e.preventDefault(); - }; - - const useKey = (superKey: string, key: string, target: MutableRefObject) => { - useKeys([superKey, key], handleCmdK, { target }); - }; - - useKey("ControlLeft", "KeyK", containerRef); - - useKey("ControlRight", "KeyK", containerRef); - - useKey("MetaRight", "KeyK", containerRef); - - useKey("MetaLeft", "KeyK", containerRef); - - useDidUpdate(async () => { - const results = await fetchRecommendations(3, searchTerm); - - setFetchedData(results); - }, [searchTerm]); - - return ( -
-
-

- {`Find `} - - - Open-Source Repositories - - -
- to contribute today -

-
- - -
-
- search icon - - - searchTerm} - placeholder="Search repositories" - type="text" - value={searchTerm} - onChange={e => setValueDebounced(e.target.value)} - onFocus={() => setFocus(true)} - onBlur={() => - setTimeout(() => { - setFocus(false); - }, 200)} - onKeyUp={(event: React.KeyboardEvent) => { - if (event.key === "Enter") { - window.open(comboBoxSelection, "_blank", "noreferrer"); - } - }} - /> - -
- - command k -
- -
- - {fetchedData.length > 0 && ( -
-
-

Repository

-
- - {fetchedData.map(data => ( - (active ? "bg-gray-50" : "")} - value={`https://app.opensauced.pizza/s/${data.full_name}`} - > - - - ))} -
- )} -
-
-
+const Hero = () => ( +
+
+

+ {`Find `} + + + Open-Source Repositories + + +
+ to contribute today +

- ); -}; +
+); export default Hero; diff --git a/src/components/HotRepoCard.tsx b/src/components/HotRepoCard.tsx index 37653d90..ba4ad403 100644 --- a/src/components/HotRepoCard.tsx +++ b/src/components/HotRepoCard.tsx @@ -27,7 +27,7 @@ const HotRepoCard = ({ repoName }: HotRepoCardProps): JSX.Element => { rel="noreferrer" target="_blank" href={`${String( - `${bugReportLink} repo not found [${repoName}]&body=Please take a look why this ${repoName} not founded` + `${bugReportLink} repo not found [${repoName}]&body=Please take a look why this ${repoName} not founded`, )}`} > Report a bug @@ -40,7 +40,10 @@ const HotRepoCard = ({ repoName }: HotRepoCardProps): JSX.Element => { if (isLoading) { return (
- +
); } @@ -52,9 +55,15 @@ const HotRepoCard = ({ repoName }: HotRepoCardProps): JSX.Element => {
- Hot Repo Icon - - {owner} + Hot Repo Icon + + + {owner} +
@@ -68,25 +77,40 @@ const HotRepoCard = ({ repoName }: HotRepoCardProps): JSX.Element => { {name} -

{description}

+

+ {description} +

- - - {humanizeNumber(issues)} + + + + {humanizeNumber(issues)} +
- - - {humanizeNumber(stars)} + + + + {humanizeNumber(stars)} +
- + 0
diff --git a/src/components/PrimaryNav.tsx b/src/components/PrimaryNav.tsx index 0de05cfb..4b2b9dd0 100644 --- a/src/components/PrimaryNav.tsx +++ b/src/components/PrimaryNav.tsx @@ -26,13 +26,11 @@ const PrimaryNav = (): JSX.Element => { useEffect(() => { const fetchAuthSession = async () => { if (currentUser?.access_token) { - await fetch(`${import.meta.env.VITE_API_URL}/auth/session`, { - headers: { accept: "application/json", Authorization: `Bearer ${currentUser.access_token}` }, - }).catch((err) => console.log("error: ", err)); + await fetch(`${import.meta.env.VITE_API_URL}/auth/session`, { headers: { accept: "application/json", Authorization: `Bearer ${currentUser.access_token}` } }).catch(err => console.log("error: ", err)); } }; - fetchAuthSession().catch((err) => console.log(err)); + fetchAuthSession().catch(err => console.log(err)); }, [userAndTokens]); return ( @@ -42,14 +40,21 @@ const PrimaryNav = (): JSX.Element => {
{userAndTokens && ( - +
@@ -90,9 +95,13 @@ const PrimaryNav = (): JSX.Element => {
-

{userAndTokens.user.user_metadata.full_name}

+

+ {userAndTokens.user.user_metadata.full_name} +

-

{userAndTokens.user.user_metadata.user_name}

+

+ {userAndTokens.user.user_metadata.user_name} +

@@ -100,8 +109,7 @@ const PrimaryNav = (): JSX.Element => { {({ active }) => (