|
@@ -15,7 +15,7 @@ import ProfileModal from "../common/ProfileModal";
|
|
import LayerContainer from "@src/containers/common/LayerContainer";
|
|
import LayerContainer from "@src/containers/common/LayerContainer";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import useLogin from "@src/hooks/useLogin";
|
|
import useLogin from "@src/hooks/useLogin";
|
|
-import { useHistory } from "react-router";
|
|
|
|
|
|
+import { useHistory, useLocation } from "react-router";
|
|
import { fetchUserInfo } from "@src/store/reducers/UserReducer";
|
|
import { fetchUserInfo } from "@src/store/reducers/UserReducer";
|
|
import { YoutubeIcon } from "../common/icon/youtube";
|
|
import { YoutubeIcon } from "../common/icon/youtube";
|
|
import { useDebounce, useOnClickOutside} from "usehooks-ts";
|
|
import { useDebounce, useOnClickOutside} from "usehooks-ts";
|
|
@@ -32,6 +32,7 @@ const Header: React.FC = () => {
|
|
const { userInfo, isUserInfoLoaded } = useSelector((store) => store.user);
|
|
const { userInfo, isUserInfoLoaded } = useSelector((store) => store.user);
|
|
const onSearch = () => {
|
|
const onSearch = () => {
|
|
history.push(URLInfo.getSearchResultUrl(keyword));
|
|
history.push(URLInfo.getSearchResultUrl(keyword));
|
|
|
|
+ setShowAutoComplete(false)
|
|
};
|
|
};
|
|
const SelectTextComplete = (text: string) => {
|
|
const SelectTextComplete = (text: string) => {
|
|
history.push(URLInfo.getSearchResultUrl(text));
|
|
history.push(URLInfo.getSearchResultUrl(text));
|
|
@@ -42,6 +43,7 @@ const Header: React.FC = () => {
|
|
const debouncedValue = useDebounce<string>(keyword, 1000)
|
|
const debouncedValue = useDebounce<string>(keyword, 1000)
|
|
const [showCommunity, setShowCommunity] = useState(false);
|
|
const [showCommunity, setShowCommunity] = useState(false);
|
|
const [showProfile, setShowProfile] = useState<boolean>(false);
|
|
const [showProfile, setShowProfile] = useState<boolean>(false);
|
|
|
|
+ const location = useLocation();
|
|
const { handleClickLoginButton, loginText } = useLogin();
|
|
const { handleClickLoginButton, loginText } = useLogin();
|
|
const { hint } = useSelector((state) => state.explore)
|
|
const { hint } = useSelector((state) => state.explore)
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -72,6 +74,12 @@ const Header: React.FC = () => {
|
|
dispatchHint(keyword)
|
|
dispatchHint(keyword)
|
|
}, [debouncedValue]);
|
|
}, [debouncedValue]);
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ if(!URLInfo.isExplorePage(location)){
|
|
|
|
+ setKeyword('')
|
|
|
|
+ }
|
|
|
|
+ }, [location])
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div className={cx("header_wrap")}>
|
|
<div className={cx("header_wrap")}>
|
|
<div className={cx("header_group")}>
|
|
<div className={cx("header_group")}>
|