diff --git a/web/src/components/Header.tsx b/web/src/components/Header.tsx index 11f44b0a..57fd477a 100644 --- a/web/src/components/Header.tsx +++ b/web/src/components/Header.tsx @@ -31,6 +31,7 @@ const Header = () => { locationStore.clearQuery()} > {t("common.home")} diff --git a/web/src/components/HomeSidebar.tsx b/web/src/components/HomeSidebar.tsx index cae4a3c6..ef2c78a6 100644 --- a/web/src/components/HomeSidebar.tsx +++ b/web/src/components/HomeSidebar.tsx @@ -1,6 +1,4 @@ import { isUndefined } from "lodash-es"; -import { useEffect } from "react"; -import { useLocationStore } from "../store/module"; import ShortcutList from "./ShortcutList"; import TagList from "./TagList"; import SearchBar from "./SearchBar"; @@ -8,13 +6,6 @@ import UsageHeatMap from "./UsageHeatMap"; import "../less/home-sidebar.less"; const HomeSidebar = () => { - const locationStore = useLocationStore(); - const query = locationStore.state.query; - - useEffect(() => { - toggleHomeSidebar(false); - }, [query]); - return ( <>
toggleHomeSidebar(false)}>
diff --git a/web/src/components/SearchBar.tsx b/web/src/components/SearchBar.tsx index a78c7b94..830c41e4 100644 --- a/web/src/components/SearchBar.tsx +++ b/web/src/components/SearchBar.tsx @@ -1,18 +1,12 @@ import { useEffect, useState, useRef } from "react"; -import { useTranslation } from "react-i18next"; import useDebounce from "../hooks/useDebounce"; import { useLocationStore, useDialogStore } from "../store/module"; -import { memoSpecialTypes } from "../helpers/filter"; import Icon from "./Icon"; -import "../less/search-bar.less"; const SearchBar = () => { - const { t } = useTranslation(); const locationStore = useLocationStore(); const dialogStore = useDialogStore(); - const memoType = locationStore.state.query.type; const [queryText, setQueryText] = useState(""); - const [isFocus, setIsFocus] = useState(false); const inputRef = useRef(null); useEffect(() => { @@ -49,68 +43,22 @@ const SearchBar = () => { [queryText] ); - const handleMemoTypeItemClick = (type: MemoSpecType | undefined) => { - const { type: prevType } = locationStore.getState().query ?? {}; - if (type === prevType) { - type = undefined; - } - locationStore.setMemoTypeQuery(type); - }; - const handleTextQueryInput = (event: React.FormEvent) => { const text = event.currentTarget.value; setQueryText(text); }; - const handleFocus = () => { - setIsFocus(true); - }; - - const handleBlur = () => { - setIsFocus(false); - }; - return ( -
-
- - -
-
-
-

{t("search.quickly-filter").toUpperCase()}

-
- {t("common.type").toUpperCase()}: -
- {memoSpecialTypes.map((type, idx) => { - return ( -
- { - handleMemoTypeItemClick(type.value as MemoSpecType); - }} - > - {t(type.text)} - - {idx + 1 < memoSpecialTypes.length ? / : null} -
- ); - })} -
-
-
-
+
+ +
); }; diff --git a/web/src/components/UpdateVersionBanner.tsx b/web/src/components/UpdateVersionBanner.tsx index 588201ee..200f10eb 100644 --- a/web/src/components/UpdateVersionBanner.tsx +++ b/web/src/components/UpdateVersionBanner.tsx @@ -2,9 +2,8 @@ import { useEffect, useState } from "react"; import { compare } from "semver"; import * as api from "../helpers/api"; import * as storage from "../helpers/storage"; -import Icon from "./Icon"; -import "../less/about-site-dialog.less"; import { useGlobalStore } from "../store/module"; +import Icon from "./Icon"; interface State { latestVersion: string; @@ -52,7 +51,7 @@ const UpdateVersionBanner: React.FC = () => { New Update {state.latestVersion} -
diff --git a/web/src/less/search-bar.less b/web/src/less/search-bar.less deleted file mode 100644 index f932c00c..00000000 --- a/web/src/less/search-bar.less +++ /dev/null @@ -1,69 +0,0 @@ -.search-bar-container { - @apply relative w-full; - - &:hover, - &:active { - > .quickly-action-wrapper { - @apply flex; - } - } - - &.is-focus { - > .quickly-action-wrapper { - @apply flex; - } - } - - > .search-bar-inputer { - @apply h-9 flex flex-row justify-start items-center w-full py-2 px-3 sm:px-4 rounded-md bg-gray-200 dark:bg-zinc-700; - - > .icon-img { - @apply w-4 h-auto opacity-30 dark:text-gray-200; - } - - > .text-input { - @apply flex ml-2 w-24 grow text-sm outline-none bg-transparent dark:text-gray-200; - } - } - - > .quickly-action-wrapper { - @apply hidden absolute top-9 -right-2 p-2 w-60 z-10; - - > .quickly-action-container { - @apply flex flex-col justify-start items-start w-full bg-white dark:bg-zinc-700 px-4 py-3 rounded-lg; - box-shadow: 0 0 4px 0 rgb(0 0 0 / 20%); - - > .title-text { - @apply text-gray-600 dark:text-gray-400 text-xs; - } - - > .types-container { - @apply flex flex-row justify-start items-start w-full text-xs mt-2; - - > .section-text { - @apply text-gray-600 dark:text-gray-400 mr-1 shrink-0 leading-6; - } - - > .values-container { - @apply flex flex-row justify-start items-start flex-wrap select-none; - - > div { - @apply flex flex-row justify-start items-center leading-6; - - .type-item { - @apply cursor-pointer px-2 rounded dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-zinc-600; - - &.selected { - @apply !bg-green-600 text-white; - } - } - - .split-text { - @apply text-gray-400 mx-1; - } - } - } - } - } - } -}