|
|
|
@ -4,7 +4,6 @@ import { getDateString } from "@/helpers/datetime";
|
|
|
|
|
import { useFilterStore } from "@/store/module";
|
|
|
|
|
import { useTranslate } from "@/utils/i18n";
|
|
|
|
|
import Icon from "./Icon";
|
|
|
|
|
import "@/less/memo-filter.less";
|
|
|
|
|
|
|
|
|
|
const MemoFilter = () => {
|
|
|
|
|
const t = useTranslate();
|
|
|
|
@ -19,34 +18,44 @@ const MemoFilter = () => {
|
|
|
|
|
}, [location]);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={`filter-query-container ${showFilter ? "" : "!hidden"}`}>
|
|
|
|
|
<div
|
|
|
|
|
className={`flex flex-row justify-start items-start w-full flex-wrap px-2 pb-2 text-sm font-mono leading-7 dark:text-gray-300 ${
|
|
|
|
|
showFilter ? "" : "!hidden"
|
|
|
|
|
}`}
|
|
|
|
|
>
|
|
|
|
|
<span className="mx-2 text-gray-400">{t("common.filter")}:</span>
|
|
|
|
|
<div
|
|
|
|
|
className={"filter-item-container " + (tagQuery ? "" : "!hidden")}
|
|
|
|
|
className={
|
|
|
|
|
"max-w-xs flex flex-row justify-start items-center px-2 mr-2 cursor-pointer dark:text-gray-300 bg-gray-200 dark:bg-zinc-700 rounded whitespace-nowrap truncate hover:line-through " +
|
|
|
|
|
(tagQuery ? "" : "!hidden")
|
|
|
|
|
}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
filterStore.setTagFilter(undefined);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Icon.Tag className="icon-text" /> {tagQuery}
|
|
|
|
|
<Icon.Tag className="w-4 h-auto mr-1 text-gray-500 dark:text-gray-400" /> {tagQuery}
|
|
|
|
|
<Icon.X className="w-4 h-auto ml-1 opacity-40" />
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
className={"filter-item-container " + (visibility ? "" : "!hidden")}
|
|
|
|
|
className={
|
|
|
|
|
"max-w-xs flex flex-row justify-start items-center px-2 mr-2 cursor-pointer dark:text-gray-300 bg-gray-200 dark:bg-zinc-700 rounded whitespace-nowrap truncate hover:line-through " +
|
|
|
|
|
(visibility ? "" : "!hidden")
|
|
|
|
|
}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
filterStore.setMemoVisibilityFilter(undefined);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Icon.Eye className="icon-text" /> {visibility}
|
|
|
|
|
<Icon.Eye className="w-4 h-auto mr-1 text-gray-500 dark:text-gray-400" /> {visibility}
|
|
|
|
|
<Icon.X className="w-4 h-auto ml-1 opacity-40" />
|
|
|
|
|
</div>
|
|
|
|
|
{duration && duration.from < duration.to ? (
|
|
|
|
|
<div
|
|
|
|
|
className="filter-item-container"
|
|
|
|
|
className="max-w-xs flex flex-row justify-start items-center px-2 mr-2 cursor-pointer dark:text-gray-300 bg-gray-200 dark:bg-zinc-700 rounded whitespace-nowrap truncate hover:line-through"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
filterStore.setFromAndToFilter();
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Icon.Calendar className="icon-text" />
|
|
|
|
|
<Icon.Calendar className="w-4 h-auto mr-1 text-gray-500 dark:text-gray-400" />
|
|
|
|
|
{t("common.filter-period", {
|
|
|
|
|
from: getDateString(duration.from),
|
|
|
|
|
to: getDateString(duration.to),
|
|
|
|
@ -56,12 +65,15 @@ const MemoFilter = () => {
|
|
|
|
|
</div>
|
|
|
|
|
) : null}
|
|
|
|
|
<div
|
|
|
|
|
className={"filter-item-container " + (textQuery ? "" : "!hidden")}
|
|
|
|
|
className={
|
|
|
|
|
"max-w-xs flex flex-row justify-start items-center px-2 mr-2 cursor-pointer dark:text-gray-300 bg-gray-200 dark:bg-zinc-700 rounded whitespace-nowrap truncate hover:line-through " +
|
|
|
|
|
(textQuery ? "" : "!hidden")
|
|
|
|
|
}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
filterStore.setTextFilter(undefined);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Icon.Search className="icon-text" /> {textQuery}
|
|
|
|
|
<Icon.Search className="w-4 h-auto mr-1 text-gray-500 dark:text-gray-400" /> {textQuery}
|
|
|
|
|
<Icon.X className="w-4 h-auto ml-1 opacity-40" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|