chore: update view store

This commit is contained in:
Steven
2023-07-10 21:34:13 +08:00
parent 9455824a2d
commit 05bc21b660
5 changed files with 35 additions and 22 deletions

View File

@@ -1,9 +1,9 @@
import useFilterStore from "../stores/v1/filter";
import useViewStore from "../stores/v1/filter";
import Icon from "./Icon";
const FilterView = () => {
const filterStore = useFilterStore();
const filter = filterStore.filter;
const viewStore = useViewStore();
const filter = viewStore.filter;
const shouldShowFilters = filter.tag !== undefined;
if (!shouldShowFilters) {
@@ -16,7 +16,7 @@ const FilterView = () => {
{filter.tag && (
<button
className="ml-2 px-2 py-1 flex flex-row justify-center items-center bg-gray-200 rounded-full text-gray-500 text-sm hover:line-through"
onClick={() => filterStore.setFilter({ tag: undefined })}
onClick={() => viewStore.setFilter({ tag: undefined })}
>
<Icon.Tag className="w-4 h-auto mr-1" />#{filter.tag}
</button>

View File

@@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
import toast from "react-hot-toast";
import { shortcutService } from "../services";
import useFaviconStore from "../stores/v1/favicon";
import useFilterStore from "../stores/v1/filter";
import useViewStore from "../stores/v1/filter";
import useUserStore from "../stores/v1/user";
import { absolutifyLink } from "../helpers/utils";
import { showCommonDialog } from "./Alert";
@@ -23,7 +23,7 @@ const ShortcutView = (props: Props) => {
const { shortcut, handleEdit } = props;
const { t } = useTranslation();
const currentUser = useUserStore().getCurrentUser();
const filterStore = useFilterStore();
const viewStore = useViewStore();
const faviconStore = useFaviconStore();
const [favicon, setFavicon] = useState<string | undefined>(undefined);
const [showQRCodeDialog, setShowQRCodeDialog] = useState<boolean>(false);
@@ -125,7 +125,7 @@ const ShortcutView = (props: Props) => {
<span
key={tag}
className="text-gray-400 text-sm font-mono leading-4 cursor-pointer hover:text-gray-600"
onClick={() => filterStore.setFilter({ tag: tag })}
onClick={() => viewStore.setFilter({ tag: tag })}
>
#{tag}
</span>